0

这是我的表格

<%= form_for @post do |f| %>
    <div class="input">
    <div class="input-label"><label for="title">Title</label></div>
    <div class="input-txt"><%= f.text_field :title %></div>
    </div>
    <div class="input">
    <div class="input-label"><label for="login">Description</label></div>
    <div class="input-txt txt-area"><%= f.text_area :description %></div>
    </div>

        #This will load dynamic  select boxes through ajax
        <%= select_tag label.head_name, options_for_select(generate_option(label)) %>
<% end %>

我正在更新上面的表格

def update_ctrl
    @post = Post.find_by_id post_id
    @post.update_attributes(post_params) #This works
    @post.update_attributes(content: params[:style]) #This is not working
end  


private
    def post_params
        params.require(:post).permit(:title,:description)
     end

我该如何解决如何在我的控制器中获取 select_tag 参数。有什么办法吗

4

0 回答 0