Now, my problem is that if thats the way I have to go then , how do I
create a collection/hash/array of member_phones so that I can accept
mutliple member_phones on the view. Again a problem here as I can’t use
formtastic gem because for one it would require a lot of custom styling
and I already have an application template for the whole application
that I have to use. And , also the hosting service which I may end up
finally end up to host my app will not allow any gems installation.
Therefore, I am stuck with default setup and javascript/jquery use to
customise my views.
Please quote the previous message when replying, it makes it easier to
follow the thread. Remember that this is an email list not a forum
(though you may be accessing it through a forum. Thanks.
NoMethodError (undefined method member_phones' for #<Member:0x000000022d3938>): app/controllers/home_controller.rb:43:in member’
Please post the code of member.rb and member_phones.rb (snip out any
irrelevant methods that may be there). Also the code from
home_controller around the error. Thanks.
Please quote the previous message when replying, it makes it easier to
follow the thread. Remember that this is an email list not a forum
(though you may be accessing it through a forum. Thanks.
NoMethodError (undefined method member_phones' for #<Member:0x000000022d3938>): app/controllers/home_controller.rb:43:in member’
Please post the code of member.rb and member_phones.rb (snip out any
irrelevant methods that may be there). Also the code from
home_controller around the error. Thanks.
Colin
home_controller
def member
@member = Member.new
@member.family_id = random_number(5)
@member_id=random_number(6)
@[email protected]_phones.build
end
And the view member.html.erb has :
Home :
<%= text_field "member_phone", "home_phone", :class =>
"input_text" %>
</label>
class MemberPhone < ActiveRecord::Base
belongs_to :member, :foreign_key => “member_id”
end
class Member < ActiveRecord::Base
alias_attribute :family_member_id, :member_id