Search Results

Search found 7 results on 1 pages for 'foxdemon'.

Page 1/1 | 1 

  • Can nested attributes be used in combination with inheritance?

    - by FoxDemon
    I have the following classes: Project Person Person Developer Person Manager In the Project model I have added the following statements: has_and_belongs_to_many :people accepts_nested_attributes_for :people And of course the appropriate statements in the class Person. How can I add an Developer to a Project through the nested_attributes method? The following does not work: @p.people_attributes = [{:name => "Epic Beard Man", :type => "Developer"}] @p.people => [#<Person id: nil, name: "Epic Beard Man", type: nil>] As you can see the type attributes is set to nil instead of Developer.

    Read the article

  • RESTful membership

    - by FoxDemon
    I am currentlly trying to design a RESTful MembershipsController. The controller action update is used only for promoting, banning, approving,... members. To invoke the update action the URL must contain a Parameter called type with the appropriate value. I am not too sure if that is really RESTful design. Should I rather introduce sepearate actions for promoting,... members? class MembershipsController < ApplicationController def update @membership= Membership.find params[:id] if Membership.aasm_events.keys.include?(params[:type].to_sym) #[:ban, :promote,...] @membership.send("#{params[:type]}!") render :partial => 'update_membership' end end end

    Read the article

1