i have installed file_column plugin and rmagick.
i have a model:
class Core < ActiveRecord::Base
has_one :forum_topic
has_many :votes
has_many :forum_messages ,:through => :forum_topic
attr_accessible :site,:descriptionm,:image
file_column :image
...
and in form i have:
<tr>
<td>USERNAME*:</td>
<td><%= text_field "user", "name",
"size" => 25, "maxlength" => 25
%></td>
</tr>
<tr>
<td>ICONA: <font
class=''nota''>(.jpg,.gif,.png)</td>
<td><%= file_column_field "core", "image"
%></td>
</tr>
and in action of form i have:
@user=User.create(params[:user])
if params[:regions]
@regions=Region.find(params[:regions])
@user.regions=@regions
end
if @user.save
@user.image=params[:core][:image]
@user.save
So it works. the file is uploaded correctly and the record is saved in
db.
If i edit model so:
class Core < ActiveRecord::Base
has_one :forum_topic
has_many :votes
has_many :forum_messages ,:through => :forum_topic
attr_accessible :site,:descriptionm,:image
file_column :image, :magick => {
:geometry => "400x400",
:versions =>
{
:small => {:crop => "1:1", :size
=>
"62×62!" },
:thumb => {:crop => "1:1", :size
=>
"30×30!" },
:medium => { :size => "600×600" }
}
I receive this error:
Trying to access file_column, but primary key got lost.
The error is at the istruction:
@user=User.create(params[:user])
Why? How i can do?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---