I am getting this error
NoMethodError in Admin#add_to_project
undefined method `find’ for #Project:0x249da88
RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/
base.rb:1501:in method_missing' ./script/../config/../app/controllers/admin_controller.rb:65:in
add_to_project’
The following code:
application.rb
private
def get_project
session[:project_in_progress] ||= Project.new
end
project_controller.rb
def new_general
@project = get_project
@general = GeneralItem.new
@general_tab = “current”
end
Get the current Project session and
add the current Object to it
def add_to_project
@project = get_project
@project.find(params[:id])
redirect_to(:action => new_license)
end
new_general.rhtml
<%= start_form_tag :action => ‘add_to_project’, :id => @project %>
Time in
<%= datetime_select (:general, :time_in) %>
project.rb
attr_reader :proj_hash
@items is an array to hold session Objects
def add_item(items)
@proj_hash << items
end