Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update
- @post = Post.find(params[:id])
- @categories = Category.all
- @post.update_attributes(params[:post])
- respond_with(@post)
- end
- ---------------------------------
- = form_for(@post) do |f|
- - if @post.errors.any?
- div#error_explanation
- h2
- = pluralize(@post.errors.count, "error")
- | prohibited this post from being saved:
- ul
- - @post.errors.full_messages.each do |msg|
- li = msg
- div.field
- = f.label 'Заголовок:'
- br
- = f.text_field :title
- div.field
- = f.label 'Категории:'
- br
- = f.select(:category_ids, options_from_collection_for_select(@categories = Category.all, :id, :title, :selected => @post.category_ids), {}, {:multiple => true, :size => 7})
- div.field
- = f.label 'Текст:'
- br
- = f.text_area :content
- div.field
- = f.label :tags
- br
- = f.text_field :tag_list
- div.actions
- = f.submit 'Опубликовать'
Add Comment
Please, Sign In to add comment