Displaying 2 results from an estimated 2 matches for "reviewscontrol".
2010 Feb 24
4
"Sequence does not exist" for joined model
...I did the migration everything went haywire. Well, I''ve refactored
several problems and now I have another.
I have two models with a many to many relationship and additional join
model. This model has no PK id.
When I try to do a create() to this model, BLAM!
I get this...
Processing ReviewsController#create_association (for 10.242.2.10 at
2010-02-24 15:29:08) [GET]
Parameters: {"review"=>{"irb_id"=>["35540"]},
"action"=>"create_association", "id"=>"1", "controller"=>"reviews"}
ActiveRe...
2010 Jan 08
1
problem using build with has_many :through relationship
...lt; ActiveRecord::Base
# Relationships
has_many :reviews
has_many :projects, :through => :reviews
end
- review model -
class Review < ActiveRecord::Base
belongs_to :irb # foreign key - irb_id
belongs_to :project # foreign key - project_id
end
- reviews_controller -
class ReviewsController < ApplicationController
def create
@review = Project.reviews.build( :irb_id => params[:id] )
if @review.save
flash[:notice] = "IRB added."
redirect_to new_project_path
else
flash[:error] = "Unable to add IRB."
redirect_to new_projec...