简体   繁体   中英

Rails passing more than one parameters

Respected ppl ...

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

在此处输入图片说明

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 ...

在此处输入图片说明

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

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

您可以将hospital_id作为参数传递给“为员工添加绩效详细信息”链接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM