Nevermind .. got it... have my checkbox params wrong. should be
<%= check_box ''photo'', ''is_hot_item''
%>
not
<%= check_box ''is_hot_item'', @photo.is_hot_item %>
DOH! .. :)
Nola Stowe wrote:> I used scaffolding, then modified. As an after thought I added a
> "boolean" checkbox to my database, form with this tag
>
> <p>
> <%= check_box ''is_hot_item'', @photo.is_hot_item %>
> <label for="is_hot_item">hot item?</label><br>
> </p>
>
> I check it and save. But I don''t get 1 saved in my database field.
>
> :(
>
> I have just the regular old scaffolding code to save:
>
>
>
> def create
> @photo = Photo.new(params[:photo])
> if @photo.save
> flash[:notice] = ''Photo was successfully created.''
> redirect_to :action => ''list''
> else
> render :action => ''new''
> end
> end
>
> def update
> @photo = Photo.find(params[:id])
> if @photo.update_attributes(params[:photo])
> flash[:notice] = ''Photo was successfully updated.''
> redirect_to :action => ''show'', :id => @photo
> else
> render :action => ''edit''
> end
> end
>
>
>
> ant ideas???
>
> --
> http://PhpGirl.blogger.com
> http://CodeSnipers.com
--
Posted via http://www.ruby-forum.com/.