How to pass 2 ids

Hi,

I want to pass 2 ids to same controller.How can i do this?
I have following code
<%= link_to “delete”, :action => “delete”, :id => @met.id %>
I also want to pass project.id to id

I want to pass 2 ids to same controller.How can i do this?
I have following code
<%= link_to “delete”, :action => “delete”, :id => @met.id %>
I also want to pass project.id to id

Logically you can’t pass 2 ids using the same param…, try using:

<%= link_to “delete”, :action => “delete”, :id => @met.id , :project_id
=> @project.id %>

Moises D. wrote:

I want to pass 2 ids to same controller.How can i do this?
I have following code
<%= link_to “delete”, :action => “delete”, :id => @met.id %>
I also want to pass project.id to id

Logically you can’t pass 2 ids using the same param…, try using:

<%= link_to “delete”, :action => “delete”, :id => @met.id , :project_id
=> @project.id %>

Thanks Moises D.,

It’s working.But i am not able to use that second id in my controller.

redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:project_id ]

This line gives the error.

It’s working.But i am not able to use that second id in my controller.

redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:project_id ]

This line gives the error.

Can you show the entire code for the action “delete” and the log of the
error…

Moises D. wrote:

It’s working.But i am not able to use that second id in my controller.

redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:project_id ]

This line gives the error.

Can you show the entire code for the action “delete” and the log of the
error…

Hi,
Here is the code i m using
This is the link from which i m calling delete:
<%= link_to “delete”, :action => “delete”, :id => project.id, :mt =>
@met.id %>

And this is delete action

def delete
@project = Project.find(params[:id])
@project.delete
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:mt]

This is the log:

NoMethodError in Project#list
Showing app/views/project/list.rhtml where line #21 raised:

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.name

Extracted source (around line #21):

18:


19:
20:
21: <%= link_to projects.met.name, :controller => “met”, :action
=>“show”, :id => projects.met.id %>
22:
23:
24: <%= link_to projects.title, :action => “show”, :id =>
projects.id %>

RAILS_ROOT: ./script/…/config/…

Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/views/project/list.rhtml:21:in
_run_rhtml_47app47views47project47list46rhtml' #{RAILS_ROOT}/app/views/project/list.rhtml:16:ineach’
#{RAILS_ROOT}/app/views/project/list.rhtml:16:in
_run_rhtml_47app47views47project47list46rhtml' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:326:insend’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:326:in
compile_and_render_template' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:301:inrender_template’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:260:in
render_file' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:806:inrender_file’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:711:in
render_with_no_layout' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/layout.rb:247:inrender_without_benchmark’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:50:in
render' C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:50:in
render' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1096:inperform_action_without_filters’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:632:in
call_filter' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:634:incall_filter’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
perform_action_without_benchmark' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
perform_action' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:insend’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in
process_without_filters' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:inprocess_without_session_management_support’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in
process' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
dispatch' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:78:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:in
synchronize' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:618:in
process_client' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:ineach’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:in
process_client' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in
initialize' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:innew’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:ininitialize’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:in
new' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:271:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:ineach’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:127:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/command.rb:211:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:243 C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:innew_constants_in’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:60 C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3
#{RAILS_ROOT}/app/views/project/list.rhtml:21:in
_run_rhtml_47app47views47project47list46rhtml' #{RAILS_ROOT}/app/views/project/list.rhtml:16:ineach’
#{RAILS_ROOT}/app/views/project/list.rhtml:16:in
_run_rhtml_47app47views47project47list46rhtml' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:326:insend’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:326:in
compile_and_render_template' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:301:inrender_template’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:260:in
render_file' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:806:inrender_file’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:711:in
render_with_no_layout' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/layout.rb:247:inrender_without_benchmark’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:50:in
render' C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:50:in
render' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1096:inperform_action_without_filters’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:632:in
call_filter' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:634:incall_filter’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
perform_action_without_benchmark' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
perform_action' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:insend’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in
process_without_filters' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:inprocess_without_session_management_support’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in
process' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
dispatch' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:78:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:in
synchronize' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:618:in
process_client' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:ineach’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:in
process_client' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in
initialize' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:innew’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:ininitialize’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:in
new' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:271:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:ineach’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:127:inrun’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/command.rb:211:in
run' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:243 C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:innew_constants_in’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:60 C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3
Request
Parameters: None

Show session dump


:user: 202
flash: !map:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

<%= link_to “delete”, :action => “delete”, :id => project.id, :mt =>
@met.id %>

def delete
@project = Project.find(params[:id])
@project.delete
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:mt]

This is the log:

NoMethodError in Project#list
Showing app/views/project/list.rhtml where line #21 raised:

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.name

Extracted source (around line #21):

18:


19:
20:
21: <%= link_to projects.met.name, :controller => “met”, :action
=>“show”, :id => projects.met.id %>
22:
23:
24: <%= link_to projects.title, :action => “show”, :id =>
projects.id %>

The link it’s ok, the redirect_to seems to be ok, but how can you get an
error on the app/views/project/list.rhtml if you are redirecting to the
‘proj’ action?.

The error in the list action seems to be that the projects variable
don’t have a met associated and then return nil and the name method for
nil isn’t defined and creates an exception…

Can you post the code for the view and action list…

Mahendra W. wrote:

I want to pass 2 ids to same controller.How can i do this?
I have following code
<%= link_to “delete”, :action => “delete”, :id => @met.id %>
I also want to pass project.id to id

The first :id is essentially a convenience, satisfying the most common
URI:
controller/action/id. You can add any other :id simply by giving it a
different name, so:

link_to “delete”, :action => “delete”, :id => @met.id, :project_id =>
project.id

Now fetch the second one into the action with params[:project_id].


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax

Moises D. wrote:

<%= link_to “delete”, :action => “delete”, :id => project.id, :mt =>
@met.id %>

def delete
@project = Project.find(params[:id])
@project.delete
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:mt]

This is the log:

NoMethodError in Project#list
Showing app/views/project/list.rhtml where line #21 raised:

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.name

Extracted source (around line #21):

18:


19:
20:
21: <%= link_to projects.met.name, :controller => “met”, :action
=>“show”, :id => projects.met.id %>
22:
23:
24: <%= link_to projects.title, :action => “show”, :id =>
projects.id %>

The link it’s ok, the redirect_to seems to be ok, but how can you get an
error on the app/views/project/list.rhtml if you are redirecting to the
‘proj’ action?.

The error in the list action seems to be that the projects variable
don’t have a met associated and then return nil and the name method for
nil isn’t defined and creates an exception…

Can you post the code for the view and action list…

view code

Projects

<%= link_to "Logout", :controller => "met", :action => "logout" %>

<%= link_to "My AccountInfo", :controller =>"met", :action => "edit", :id => @met.id %>

<%= link_to "My Project", :controller =>"project", :action => "proj", :id => @met.id %>

<%= link_to "My Training", :controller =>"training", :action => "train", :id => @met.id %>

<%= link_to "My Resume", :controller =>"project", :action => "res", :id => @met.id %>

Projects of <%= @met.name %>

<% @met.projects.each do |project| %>

<% end %>

Title

Primary Skills

Description

Duration From

Till

<%= link_to project.title, :action => "edit", :id => project.id %> <%= project.primary_skills %> <%= project.description%> <%= project.duration_from%> <%= project.duration_till%> <%= link_to "delete", :controller =>"project", :action => "delete", :id => project.id, :mt => @met.id %>

<%= link_to "Add new project", :action => "new", :id => @met.id %>

<%= link_to "Edit all project", :action => "editall", :id => @met.id %>




action code:

class ProjectController < ApplicationController
require ‘win32ole’
layout “standard-layout”
scaffold :project

def new
@project = Project.new
@mets = Met.find(@params[“id”])
end

def update
@project = Project.find(params[:id])
@project.save
if @project.update_attributes(params[:project])
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
@project.met_id
else
render_action ‘edit’
end
end

def delete
@project = Project.find(params[:id])
@project.delete
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
params[:mt]

end

def updateall
@project = Project.find(params[:id])
@project.save
if @project.update_attributes(params[:project])
redirect_to :controller =>‘project’, :action => ‘editall’, :id =>
@project.met_id
else
render_action ‘editall’
end
end

def edit
@project = Project.find(@params[“id”])
@mets =Met.find_all
if session[:user] != @project.met_id
redirect_to :controller =>‘met’, :action => ‘login’
end
end

def editall
@met =Met.find(params[:id], :include => :projects)
end

def submitP
@project = Project.find(params[:id])
redirect_to :controller =>‘project’, :action => ‘proj’, :id =>
@project.met_id
end

def list
@project = Project.find_all
@mets =Met.find_all
end

def proj
@met =Met.find(params[:id], :include => :projects)
if session[:user] != @met.id
redirect_to :controller =>‘met’, :action => ‘login’
end
end

def create
@project = Project.new(params[:project])
if @project.save
redirect_to :action => ‘proj’, :id => @project.met_id
else
redirect_to :action => ‘new’, :id => @project.met_id
end
end

def delete
Project.find(@params[‘id’]).destroy
redirect_to :action => ‘list’
end

def res
@met =Met.find(params[:id], :include => [:projects, :trainings,
:gaps])
if session[:user] != @met.id
redirect_to :controller =>‘met’, :action => ‘login’
end

@train = @met.trainings.find(params[:id])

@train = Training.find(@params[“id”])

end

def resume
@met =Met.find(params[:id], :include => [:projects, :trainings,
:gaps])
end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs