Greets to the list,
I just started learning RoR, coming from a PHP/MYSQL background. So
this is all new for me…
I have a project where I need to upload a picture into my db.
I have been reading the wiki (I wish it was more complete) and have
gleaned the code to upload directly into a database.
My form is setup correctly, as I can insert data into the DB without
issues. Now I am trying to store a jpg coming from the form field
listings[pic]. When I submit the form, I get this error:
NoMethodError in Admin#create
undefined method `filename=’ for #Listing:0xb7916be0
Code is at the bottom, I know it’s probrally a mess, but I’ve only
been at this for a few days.
Any insight would be great.
@params[‘listing’][‘picture’] = @params[‘listing’][‘pic’].read
@listing = Listing.new(params[:listing]) if @listing.save flash[:notice] = 'Listing was successfully created.' redirect_to :action => 'list' else render :action => 'new' end #redirect_to :action => "show", :id => object_id