Displaying 2 results from an estimated 2 matches for "initialized_interactions".
2013 Mar 24
5
Rails 4.0 has_many_through and fields_for
...ActiveRecord::Base
has_many :interactions, dependent: :destroy
has_many :roles, through: :interactions
scope :controllers, lambda {|name| where("controller_name_id = ?",
name)}
scope :actions, lambda {|name| where("action_name_id = ?", name)}
def initialized_interactions() # this is the key method
[].tap do |o|
Role.all.each do |r|
if p = interactions.find { |p| p.role_id == r.id }
o << p.tap { |p| p.enable ||= true }
else
o << Interaction.new(:role_id => r.id)
end...
2013 Mar 18
9
Rails 4.0 Example app
Hi All,
I have 30 years as a self employed software engineer and have been
experimenting with rails for several years but !!
I would have made considerably more progress and been able to give back to
the community if only there was a demo application that was released with
each new rails release.
I am sure that it would take no more than 15 minutes of someone within the
core team to produce