def selected
@enquiries = Enquiry.all
@enquiry_details = EnquiryDetail.all
@comments = Comment.all
@enquiries.where("created_at >= ? AND created_at <= ?", Time.zone.now.beginning_of_day, Time.zone.now.end_of_day)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @enquiries and @enquiry_details and @comments }
end
end
如何在我的视图中调用此方法。
<%= link_to '<button type="button">SELECT</button>'.html_safe, method: :selected %>
答案 0 :(得分:0)
为 selected
操作创建路线,然后执行此操作;
<%= button_to "SELECT", { :controller => "CONTROLLER", :action => "selected"} %>