This file contains hidden or 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
<%= javascript_tag do %> | |
<%= render "plupload.js"%> | |
<% end%> | |
<%= form_for(@post) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> |
This file contains hidden or 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
<%= javascript_tag do %> | |
<%= render "jsupload.js"%> | |
<% end%> | |
<%= form_for(@post) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> |
This file contains hidden or 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
Parameters: {"uploader_0_status"=>"done", "uploader_0_name"=>"IMG_1181.JPG", "commit"=>"Creat | |
e Post", "post"=>{"category"=>"asd", "title"=>"asd", "content"=>"asd", "attachments_attributes" | |
=>{"0"=>{"photo"=>#<ActionDispatch::Http::UploadedFile:0x1367296d8 @headers="Content-Dispositio | |
n: form-data; name=\"post[attachments_attributes][0][photo]\"; filename=\"IMG_1169.JPG\"\r\nCon | |
tent-Type: image/jpeg\r\n", @content_type="image/jpeg", @tempfile=#<File:/var/folders/gs/btvwgg | |
x90nn096h8zqy5mhnm0000gn/T/RackMultipart20111123-2763-1ay9rz2-0>, @original_filename="IMG_1169. | |
JPG">, "attachment_category_id"=>"2"}}}, "uploader_0_tmpname"=>"p16f9gerlk15ep1kf12lc1bp81gsq4. | |
JPG", "authenticity_token"=>"VlL0nWBuKGsQh+k/vHxTffGlEtloXlOEYLQTHkCtBes=", "utf8"=>"\342\234\2 | |
23", "uploader_count"=>"1"} |
This file contains hidden or 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
class AttachmentCategory < ActiveRecord::Base | |
belongs_to :post | |
has_many :attachments | |
accepts_nested_attributes_for :attachments | |
validates :category_name, :presence =>true | |
end |
This file contains hidden or 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
<%= form_for(@post) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains hidden or 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
<%= nested_form_for(@post, :remote=>true) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains hidden or 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
class Category < ActiveRecord::Base | |
has_many :posts | |
validates :category_name, :category_description, :presence => true | |
end |
This file contains hidden or 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
<h1>Listing posts</h1> | |
<%= link_to 'New Post', new_admin_post_path %> | |
<p> | |
<% @posts.each do |post| %> | |
<h2><%= post.title %></h2> | |
filed under: <%= post.category_id %> | |
<br><br> | |
<%= post.content %><br><br> | |
This file contains hidden or 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
<%= nested_form_for([:admin, @post], :remote=>true, :html => { :multipart => true }) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> |
This file contains hidden or 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
<%= nested_form_for([:admin, @post], :remote=>true, :html => { :multipart => true }) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> |
OlderNewer