On Thursday, January 21, 2016 at 11:40:30 PM UTC-5, Przemek Kosakowski 
wrote:
>
> Hello,
>
> can you show your model and controller file ?
>
class PicturesController < ApplicationController
  def index
    @pictures = Picture.all
  end

  def new
   @picture = current_user.profile.pictures.new
  end

  def create
    @picture = Picture.new(picture_params)

    if @picture.save
      redirect_to current_user_profile_pictures_path, notice: "The picture 
#{@picture.name} has been uploaded."
    else
      render "new"
    end
  end

  def destroy
    @picture = Picture.find(params[:id])
    @picture.destroy
    redirect_to current_user_profile_pictures_path, notice:  "The picture 
#{@picture.name} has been deleted."
  end
=============================================================================
class Picture < ActiveRecord::Base
 belongs_to :imageable, polymorphic: true
 mount_uploader :imageable, PictureUploader
 validates :name, presence: true
end

private
  def picture_params
    params.require(:picture).permit(:name, :attachment)
  end
end
 

>
> W dniu 22.01.2016 o 05:16, fugee ohu pisze:
>
> This form raises undefined method `pictures_path' for 
> #<#<Class:0xaea3ad0>:0xbb9cb4c>
>
> <%= form_for(@picture, :html => { :multipart => true }) do |f| %>
>
>   <p>
>     <%= f.file_field :image %>
>   </p>
>
>   <p><%= f.submit %></p>
>
> <% end %>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-ta...@googlegroups.com <javascript:>.
> To post to this group, send email to rubyonra...@googlegroups.com 
> <javascript:>.
> To view this discussion on the web visit 
> <https://groups.google.com/d/msgid/rubyonrails-talk/345bb1b7-2849-4271-92e3-59c228d2c596%40googlegroups.com?utm_medium=email&utm_source=footer>
> https://groups.google.com/d/msgid/rubyonrails-talk/345bb1b7-2849-4271-92e3-59c228d2c596%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c3e21d24-f4fd-4adf-a32c-166aff0bb2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to