Hi
I have a model called navbar. It does not have a view or a controller
defined.
create_table :navbars do |t|
t.string :name
t.string :display_name
t.string :url
t.string :group_by_module
t.boolean :default_link
t.integer :sort_order
And in the model I have written few methods.
class Navbar < ActiveRecord::Base
def all_modules
NavBar.find (:display_name, :url, :conditions => {:name =>
'module_bar'}, :order => 'sort_order')
end
def associated_quick_links (selected_module)
NavBar.find (:display_name, :url, :default_link, :conditions =>
{:name => 'quick_links_bar', :group_by_module =>
selected_module}, :order => 'sort_order')
end
def associated_module (selected_quick_link)
NavBar.find (:group_by_module, :conditions => {:name =>
'quick_links_bar', :display_name => selected_quick_links})
end
end
QUESTION --- I want to access these methods from views directly. When
I do <%= debug navbar.all_modules %> it fails. It cannot find the
navbar.
Can someone please guide me?
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---