1) Use a helper column override.
2) what do you mean by extra "sql keys"? Tables? Params mapping to ? ?

On Jan 6, 7:32 am, johnnybutler7 <[email protected]> wrote:
> Hi,
>
> A few questions on this that im stuck on, hopefully someone can help
> me out.
>
> 1)I have the following code below which gives a multiple checkboxes
> which is what i want,
>
> config.columns[:surveys].ui_type = :select
>
> I have a column called name on the surveys model which it defaults to
> but i want to change this to
> #{surveys.name} #{surveys.score} but i dont want to overide the
> to_label method as this model is used in other active scaffolds where
> i want just the name displayed and not the score.  Whats the easiest
> way to this?
>
> 2) For the same column i want to filter what surveys are diaplyed
> depending on what the company of the user is.
> So i have :
>
> def options_for_association_conditions(association)
>   if association.name == :surveys
>    client_id = @record.primary_survey.user_id
>        ["surveys.user_id = ?",client_id]
>     else
>       super
>    end
>
> This works fine however i really want it so it displays all surveys
> that belong to a users company so something like:
>
> def options_for_association_conditions(association)
>   if association.name == :surveys
>    company_id = @record.primary_survey.user.company_id
>        :joins => 'blah...............,
>       :conditions => ["users.company_id = ?",company_id],
>     else
>       super
>    end
>
> Is there any way to add extra sql keys aswell as the conditions?
>
> thanks
>
> JB
--~--~---------~--~----~------------~-------~--~----~
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