On Mon, Aug 31, 2009 at 3:38 PM, karthik k <cse.k.kart...@gmail.com> wrote:

>
>
> On Mon, Aug 31, 2009 at 3:33 PM, Colin Law <clan...@googlemail.com> wrote:
>
>>
>> 2009/8/31 Colin Law <clan...@googlemail.com>:
>> > 2009/8/31 karthik k <cse.k.kart...@gmail.com>:
>> >> hi guys
>> >>
>> >> I need to know how to call one method declared in one model to another
>> >> controller or another model
>> >>
>> >> e.g
>> >>
>> >> model1.rb
>> >>
>> >> def check1
>> >> puts "check1"
>> >> end
>> >>
>> >> model2.rb
>> >>
>> >> def check2
>> >> puts "check2"
>> >> end
>> >>
>> >> i need to access check2 method from check1
>> >> in model1.rb my line to access check2 method is
>> >>
>> >> model2.check2
>> >>
>> >
>> > I believe that You cannot call a controller model from another
>> > controller in this way.  If you need to do this it probably means that
>> > the method should be in a model or in a module in the lib directory.
>> > Or are you actually trying to redirect to a different action rather
>> > than just call a method?
>> >
>>
>> Sorry I misread the question and the reply above is rubbish anyway.  I
>> thought you were wanting to call a controller method from another
>> controller.  I must remember to engage brain before typing.
>>
>> Colin
>>
>>
> hi Colin
>
> That is not a problem
>
> You have the mind to help that is far more enough even if you misjudged
>
> Thank you guys
>
> You save me
>
> --
> Karthik.k
> Mobile - +91-9894991640
>

Hi Guys

This is anew Question

i am writing a method in model

In check1.rb  //model
def check?
self.name="karthik"
end

when i call from controller say check2controller.rb //different controller

i am calling as
check1=check1.new
check1.check? //returns true or false

i need to pass karthik as paramater to check?in check1.rb
so that it will return true or false

Please guide me how to do
-- 
Karthik.k
Mobile - +91-9894991640
<http://kkarthikresume.blogspot.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 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