i have a form and the form is validating correctly. the relevant table
to this model has a coloum to store a some text(a auto generated text.).
to store text to this coloum i am not giving it from a normal form.
instead of that i want to pass a values to this model from a another
different model so it can save in the table.
So if I understand you correctly, it sounds like you have two models:
A and B. Model A has an attribute that allows text to be stored in it,
and this attribute is populated by model B. So, what you want to do
is:
class B < ActiveRecord::Base
id: the id of the record where the text should be stored
text: the text to be stored
def populate_text_field(id, text)
if a = A.find(id)
a.update_attribute(:text_field, text)
end
end
end
Is this what you are intending?
On Dec 5, 8:44 pm, Nadeesha M. <rails-mailing-l…@andreas-
So if I understand you correctly, it sounds like you have two models:
A and B. Model A has an attribute that allows text to be stored in it,
and this attribute is populated by model B. So, what you want to do
is:
class B < ActiveRecord::Base
id: the id of the record where the text should be stored
text: the text to be stored
def populate_text_field(id, text)
if a = A.find(id)
a.update_attribute(:text_field, text)
end
end
end
Is this what you are intending?
On Dec 5, 8:44 pm, Nadeesha M. <rails-mailing-l…@andreas-
Hi
Thanks for the tip. i think ur solution can help me to archive the
solution i want.
Thanks
Nadeesha
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.