I have fixed in git, it will be in next release

On Sábado, 31 de marzo de 2012 21:12:06 Richard Zheng escribió:
> On Mon, Sep 7, 2009 at 10:54 PM, Sergio Cambra .:: entreCables S.L. ::. <
> 
> [email protected]> wrote:
> > On Lunes, 7 de Septiembre de 2009 19:38:42 rvhi escribió:
> > > Hi,
> > > 
> > > I run into some issues with checkbox inplace_edit. When the box is
> > > checked the following params hash was sent,
> > > 
> > > <hash>
> > > 
> > >   <column>aaaa</column>
> > >   <action>bbbb</action>
> > >   <id>151</id>
> > >   <value>true</value>
> > >   <controller>cccc</controller>
> > > 
> > > </hash>
> > > 
> > > If it is unchecked, this was sent
> > > <hash>
> > > 
> > >   <column>aaaa</column>
> > >   <action>bbbb</action>
> > >   <id>151</id>
> > >   <controller>cccc</controller>
> > > 
> > > </hash>
> > > 
> > > The current implementation seems to treat them the same. Without
> > > modifying the code of 'update_column', I have the following override,
> > > 
> > >       @record.send("#{params[:column]}=", (params[:value] == 'true'))
> > >       @record.save
> > >       render :action => 'update_column'
> > > 
> > > Would be better if it can be changed in the standard implementation.
> > 
> > update_column is used for other types, so we can't assign (params[:value]
> > ==
> > 'true', that code works if you only use it for checkboxes, but we can't
> > put it
> > in ActiveScaffold.
> > 
> > When is unchecked, params[:value] is missing, so column will be set to
> > NULL.
> > If column can't be null, the following line should put the default value.
> > params[:value] ||= @record.column_for_attribute(params[:column]).default
> > unless @record.column_for_attribute(params[:column]).null
> > 
> > If your default value is true, then it doesn't work. You need override
> > do_update_column in that case:
> > def do_update_column
> > 
> >  params[:value] ||= 'false' if params[:column] ==
> > 
> > 'column_with_default_true'
> > 
> >  super
> > 
> > end
> 
> Hi Sergio,
> 
> I'd like to revisit the issue.  It is possible to check if
> @record.column_for_attribute(params[:column]).type is a :boolean.  Can we
> do this for the checkboxes?  It is not very DRY in the code to do this
> override for all boolean columns with default value true.
> 
> Thanks,
> Richard

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to