SkyKOG
SkyKOG

Reputation: 287

Rails passing more than one parameters

Respected ppl ...

I have a grave design issue since many days ...kindly help out ...

enter image description here

Im coming to this stage from the previous screen after entering the hospital_id which u can c from the URL is 10 (using ransack) ... at this stage when i click "Add performance detail for employee" im passing only the employee_id to the performance creation screen ...

enter image description here

How do i capture the hospital_id from the previous screen and store in my performance creation screen ? ... (it has field hospital_id) ....

can i somehow use this raw sql query to store hospital_id directly ? ...

SELECT hospital_id FROM employee_sanction_working WHERE employee_id

Pls do help ...

Thnx

Upvotes: 0

Views: 439

Answers (2)

Anand Soni
Anand Soni

Reputation: 5110

There are few ways you can resolve your problem:

1) you can pass hospital_id in parameter as Rubyman and Santhosh K have suggested Or

2) you can create a class variable in controller which you can use in your erb or haml view.

for example:

in controller:

def new 
    @hospital_id = params[:hospital_id] #this you can use in your view
end
in view
Hospital ID is <%= @hospital_id %>

Please refer this for more information

Upvotes: 1

Rubyman
Rubyman

Reputation: 874

You can pass the hospital_id as parameter to "Add performance detail for employee" link.

Upvotes: 0

Related Questions