OK But now, the subject is carrierwave Users has_one profile; Profile has_many pictures as :imageable I'm totally lost, I dunno what role in the upload the controller's supposed to play since i have the uploader.rb
On Friday, January 22, 2016 at 4:59:26 AM UTC-5, Przemek Kosakowski wrote: > > I see you trying upload some picture, please use this gem [1]. You be able > in easy way customize your picture uploader. > > [1]: paperclip <https://github.com/thoughtbot/paperclip> > > Have you relation between user -> profile -> picture ? > > W dniu 22.01.2016 o 10:40, fugee ohu pisze: > > > > 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. >> To post to this group, send email to rubyonra...@googlegroups.com. >> To view this discussion on the web visit >> <https://groups.google.com/d/msgid/rubyonrails-talk/345bb1b7-2849-4271-92e3-59c228d2c596%40googlegroups.com> >> 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-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/c3e21d24-f4fd-4adf-a32c-166aff0bb2dc%40googlegroups.com?utm_medium=email&utm_source=footer> > 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. > > > -- 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/e5d5fdd8-0e64-4702-ba1c-9e8edf1eabb0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.