Thanks, it worked for me to :D

On Dec 7, 1:41 pm, Antony Sastre <cubal...@gmail.com> wrote:
> Hi Ab,
>
> The form view should read:
>
> <% form_for @office, :html => {:multipart => true} do |f| %>
>
> This is always the case when dealing with file uploads.
>
> On Dec 7, 9:05 am, Abhishek shukla <bettera...@gmail.com> wrote:
>
> > Hello Friends,
>
> > I am not able to retrieve the value form page
>
> > controller
> >   offices_controller
> >     def new
> >     �...@office = Office.new
> >     end
>
> >     def create
> >     �...@office = Office.new(params[:office])
> >     �...@office.save
> >    end
> >  end
>
> > VIEW
> >   <% form_for @office do |f| %>
> >     <%= f.text_area :office_name %>
> >     <% f.fields_for :images_attributes do |i| %>
> >      <%= i.file_field :avatar %>
> >     <%end%>
> >     <%= f.submit "Submit" %>
> >   <%end%>
>
> > Model
>
> > Office.rb
> >     accepts_nested_attributes_for :image
>
> > Image.rb
> >      belongs_to :imagable, :polymorphic => true
>
> > PROBLEM
> >  When I press submit, the params[:office] only contain :office_name and
> > avatar is getting lost? I don;t know where excatly I am getting wrong.
>
> > Thanks for any suggestion
>
> > Abhis
>
>

--

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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to