J
Joshua Muheim
Hi all
I experience that the use of symbols and strings is not consistent in
Rails.
Very often I can use symbols as values in methods:
has_and_belongs_to_many :musician_profiles,
:join_table => "musician_profiles_do_show_types"
# string
has_and_belongs_to_many :musician_profiles,
:join_table => :musician_profiles_do_show_types
# symbol
But for example the link_to helper does not allow me to use a symbol
instead of a string:
link_to "Test", :controller => "news" # string
link_to "Test", :controller => :news # symbol
This second version using a symbol gives me this error:
undefined method `include?' for :
Is there any reason for this? And if not, is there a way to achieve its
functionality also with symbols, maybe using a plugin?
Thanks for infos,
Joshua
I experience that the use of symbols and strings is not consistent in
Rails.
Very often I can use symbols as values in methods:
has_and_belongs_to_many :musician_profiles,
:join_table => "musician_profiles_do_show_types"
# string
has_and_belongs_to_many :musician_profiles,
:join_table => :musician_profiles_do_show_types
# symbol
But for example the link_to helper does not allow me to use a symbol
instead of a string:
link_to "Test", :controller => "news" # string
link_to "Test", :controller => :news # symbol
This second version using a symbol gives me this error:
undefined method `include?' for :
Is there any reason for this? And if not, is there a way to achieve its
functionality also with symbols, maybe using a plugin?
Thanks for infos,
Joshua