-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec that shows nested file inputs.
- Loading branch information
Showing
12 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
coverage | ||
*.log | ||
*.pid | ||
*.swp | ||
*.tmproj | ||
.DS_Store | ||
pkg | ||
.loadpath | ||
.project | ||
bin | ||
coverage | ||
doc | ||
ri | ||
email.txt | ||
.svn | ||
log | ||
.project | ||
.loadpath | ||
*.swp | ||
pkg | ||
results | ||
ri | ||
test_apps | ||
*.tmproj | ||
*.log | ||
*.pid | ||
bin | ||
tmp | ||
vendor/gems |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Album < ActiveRecord::Base | ||
has_many :photos | ||
accepts_nested_attributes_for :photos | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Photo < ActiveRecord::Base | ||
belongs_to :album | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<%- count = 0 %> | ||
<% form_for(@album, :url => post_file_path, :html => {:multipart => true}) do |f| %> | ||
<p> | ||
<% f.fields_for :photos do |uf| %> | ||
<%= uf.label :image, "Photo #{count += 1}" %> | ||
<%= uf.file_field :image %><br/> | ||
<% end %> | ||
</p> | ||
|
||
<p> | ||
<%= f.submit 'Create' %> | ||
</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
development: | ||
adapter: sqlite3 | ||
database: "tmp/development.sqlite3" | ||
|
||
test: | ||
adapter: sqlite3 | ||
database: "tmp/test.sqlite3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ActiveRecord::Schema.define(:version => 0) do | ||
create_table :albums, :force => true do |t| | ||
t.string :name | ||
end | ||
|
||
create_table :photos, :force => true do |t| | ||
t.string :image | ||
t.integer :album_id | ||
end | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters