Julian Leviston wrote:
>> options_for_select(@subscription_types.collect {|subscription_type| [
>> subscription_type.title, subscription_type.id ] })
>>
>
> I think this is something to do with brackets and ruby not being able
> to work out what on earth you're trying to say.
>
> You have brackets on your inner method, but not your outer method, so
> ruby requires you put brackets all around everything.
>
> This is, at least, my guess.
>
> Try this:
>
> <%= select_tag('subscription',
> options_for_select(@subscription_types.collect{|subscription_type|
> [subscription_type.title, subscription_type.id]})) %>
>
> Julian.
>
> ----------------------------------------------
> Learn: http://sensei.zenunit.com/
> Last updated 20-May-09 (Rails, Basic Unix)
> Blog: http://random8.zenunit.com/
> Twitter: http://twitter.com/random8r
Hi Julian,
I tried that also but getting same error, is there any wrong in my code
I write all my related code here again.
-------------------------------------------------------------------------------
---------------------------------------------------------------------------------
code for "_plan_pricing.html.haml"
= error_messages_for :business
#plan_picker
- form_for :business, @business, :url =>
polymorphic_path(@business), :html => {:class => 'MainForm'} do |f|
= select_tag ('plan_id',
options_for_select(Plan.find(:all).collect {|plan| [ plan.title, plan.id
] })
= observe_field('plan_id', :url => {:controller => 'users',
:action => :refresh_subscription_types }, :update =>
:refresh_subcription_types, :with => "'plan_id=' + $('plan_id').value")
%span#refresh_subcription_types
= render :partial =>
'businesses/refresh_subscription_types', :layout => 'false'
%p= submit_tag :next_page.l
-------------------------------------------------------------------------------
code for "_refresh_subscription_types.html.haml"
= select_tag('subscription',
options_for_select(@subscription_types.collect {|subscription_type| [
subscription_type.title, subscription_type.id ] }))
--------------------------------------------------------------------------------
code in "controller"
def refresh_subscription_types
@subscription_types = SubscriptionType.find(:all, :conditions =>
{:plan_id => params[:plan_id]})
respond_to do |format|
format.html {
render :partial => 'businesses/refresh_subscription_types',
:layout => false
}
end
end
def plan_pricing
# I tried following @subscription_types = SubscriptionType.find(:all)
also but same error
# @subscription_types = SubscriptionType.find(:all)
@user = current_user
@business = Business.new
render :partial => "plan_pricing", :layout => 'application'
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---