On Jueves, 4 de Agosto de 2011 18:58:16 Nick Rogers escribió:
> Thanks. Makes sense.
> 
> How can I do this for datetime columns? In the past active_scaffold
> (official branch) under rails 2.3.X would automatically create a
> datetime_select form for datetime columns. Now it defaults to a blank
> textbox.

By default active scaffold in rails 2.3 rendered fields using input method, 
which used date_select for date selects. But in rails 3 there is no input 
method, so now active scaffold renders fields using text_field method by 
default.

> 
> How can I replace this form override with something that will work with
> bulk_update?
> 
>   def expires_at_form_column(record, input_name)
>     datetime_select(:record, :expires_at,
> 
>       :start_year => Time.now.year - 5, :end_year => Time.now.year + 5,
>       :default => Time.now,
>       :order => [:day, :month, :year])
> 
>   end
> 
> Thanks!
> 
> On Thu, Aug 4, 2011 at 2:48 AM, vhochstein <[email protected]>wrote:
> > Hi Nick,
> > 
> > that will not work. You will have to use a batch update form override.
> > 
> > However, even simpler would be to just set state in your config to
> > form_ui select and just set your enum as well.
> > https://github.com/activescaffold/active_scaffold/wiki/Enum-Columns
> > 
> > --
> > Volker
> > 
> > On Aug 3, 11:10 pm, Nick Rogers <[email protected]> wrote:
> > > I'm having some trouble getting batch_update to work with my scaffold.
> > > Everything appears fine visually in the form but when I click "Batch
> > 
> > Update"
> > 
> > > I get the following exception.
> > > 
> > > Started POST
> > 
> > "/admin/scaffolds/users/batch_update?eid=77a75ba90091a7c137efb8b09c3f7009
> > "
> > 
> > > for 127.0.0.1 at Wed Aug 03 16:39:06 -0400 2011
> > > 
> > >   SQL (2.5ms)   SELECT name
> > >  
> > >  FROM sqlite_master
> > >  WHERE type = 'table' AND NOT name = 'sqlite_sequence'
> > >  
> > >   Cloak Load (0.2ms)  SELECT "cloaks".* FROM "cloaks" LIMIT 1
> > >   CACHE (0.0ms)  SELECT "cloaks".* FROM "cloaks" LIMIT 1
> > >   Processing by Admin::Scaffolds::UsersController#batch_update as JS
> > >   Parameters: {"eid"=>"77a75ba90091a7c137efb8b09c3f7009",
> > 
> > "commit"=>"Batch
> > 
> > > Update", "batch_scope"=>"LISTED",
> > > "authenticity_token"=>"NVWU2Lc3+hSAU6NbYikn6gvImZsHpjJcj9W8Rx8tr/I=",
> > > "utf8"=>"\342\234\223",
> > > "record"=>{"automatic_login"=>{"operator"=>"REPLACE", "value"=>"1"},
> > > "note"=>"", "state"=>"active"}}
> > > 
> > >   AdminControllerAcl Load (0.3ms)  SELECT "admin_controller_acls".*
> > >   FROM
> > > 
> > > "admin_controller_acls" WHERE (active = 't') LIMIT 1
> > > 
> > >   Admin Load (0.2ms)  SELECT "admins".* FROM "admins" WHERE
> > >   "admins"."id"
> > 
> > =
> > 
> > > 1 LIMIT 1
> > > 
> > >   AdminRole Load (0.2ms)  SELECT "admin_roles".* FROM "admin_roles"
> > >   WHERE
> > > 
> > > "admin_roles"."id" = 1 LIMIT 1
> > > Completed 500 Internal Server Error in 45ms
> > > 
> > > NoMethodError (undefined method `merge' for "active":String):
> > > 
> > > Rendered
> > 
> > /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middlewa
> > re/templates/rescues/_trace.erb
> > 
> > > (1.0ms)
> > > Rendered
> > 
> > /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middlewa
> > re/templates/rescues/_request_and_response.erb
> > 
> > > (130.4ms)
> > > Rendered
> > 
> > /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middlewa
> > re/templates/rescues/diagnostics.erb
> > 
> > > within rescues/layout (135.8ms)
> > > 
> > > It looks like something is expecting the "state" param to be a Hash,
> > > but
> > 
> > its
> > 
> > > just a string because I did not select it as an attribute to be
> > > changed.
> > > 
> > > I think it has to do with the fact that I am using a form override for
> > 
> > some
> > 
> > > of the attributes. For example:
> > >   def state_form_column(record, input_name)
> > >   
> > >     select(:record, :state, User::STATES, { :include_blank => false })
> > >   
> > >   end
> > > 
> > > I want the "state" field to be a select dropdown instead of a textbox.
> > 
> > This
> > 
> > > works fine with the normal update action. How can I fix the helper to
> > > be compatible with batch_update?
> > > 
> > > rails 3.0.9 and rails-3.0 branch.
> > > 
> > > Appreciate any help. Thanks.
> > 
> > --
> > 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.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
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