Hi,

I have a view in which i have the following collection_select

<%= f.collection_select :category_id, current_account.categories.find
(:all), :id, :name, {:prompt => "-Select-", :include_blank => true} %>

and the current_account method in authentication.rb is

def current_account
    @current_account ||= Account.find_by_subdomain(current_subdomain)
 end

But i get the following error when i try to open the page with that
collection_select in it

undefined local variable or method `current_subdomain' for #<Project:
0x3430e60>

Does this mean i have to make this method available to all my models?
i also tried moving "current_account.categories.find(:all)" to the
controller and storing it in an instance variable and using the
instance variable here instead like

@categories = current_account.categories.find(:all)

<%= f.collection_select :category_id, @categories, :id, :name,
{:prompt => "-Select-", :include_blank => true} %>

That too threw the same error. Any idea whats the ideal way to handle
this?
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to