Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Calling multiple models in ruby on rails

ruby-on-rails-4

  • Please log in to reply
No replies to this topic

#1 dailammoc

dailammoc

    Dispatcher

  • Members
  • 38 posts
  • Location/

Posted 16 April 2014 - 10:15 AM

I have several models(a,b,c,d). In each controller file corresponding to these models(I grouped them in a directory call master), I declared a method like this:

def load_crud
    super
    @model = A
    @hash = :a
  end

now in other controller call cruds_controller.rb how can I call specifically to a,b,c or d model? I declare a method load_crud in cruds_controller.rb, but I don't know to control my code to call exactly model that I expected.







Also tagged with one or more of these keywords: ruby-on-rails-4

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users