What does send() do in Ruby?

后端 未结 6 1020
野性不改
野性不改 2020-11-28 01:49

Can someone please tell me what

send(\"#{Model.find...}\")

is and does?

6条回答
  •  鱼传尺愫
    2020-11-28 02:16

    Another use case for views:

        <%= link_to 
        send("first_part_of_path_#{some_dynamic_parameters}_end_path", 
        attr1, attr2), ....
        %>
    

    Allow . you to write scalable view who work with all kind of objects with:

        render 'your_view_path', object: "my_object"
    

提交回复
热议问题