My forms looks like this and it is for UserPreference Model

user_preference.rb

<%= form_for @user_preference do |u|%>
 <p>
    <%= u.label :title %><br>
    <%= u.text_field :title %>
  </p>

  <p>
    <%= u.label :description %><br>
    <%= u.text_field :description %>
  </p>

  <p> <%= u.label :back_ground_color %><br>
    <select name="bgcolor" id="bgcolor">
      <option value="#FF3300">Orange</option>
      <option value="#00FF00">Green</option>
      <option value="#0000FF">Blue</option>
      <option value="#FF0066">Pink</option>
      <option value="#FFFF00">Yellow</option>
      <option value="#FFFFFF">White</option>
  </select>
  </p>

  <p>
    <%= u.label :font %><br>
    <select name="font" id="font">
      <option value="Times New Roman">Times new Roman</option>
      <option value="Verdana">Verdana</option>
      <option value="Arial">Arial</option>
      <option value="sans-serif">serif</option>
  </select>
  </p>

 <br >
  <p>
    <%= u.submit %>
  </p>


user_preferences_controller.rb looks like this:
class UserPreferencesController < ApplicationController
  def new
    @user_preference = UserPreference.new
  end

  def create
    @user_preference = UserPreference.new(userp_params)
    @user_preference.save unless user_signed_in?
    render plain: params[:user_preference].inspect
  end
  def edit
  end
  def update
  end

  private
  def userp_params
    params.require(:user_preference).permit(:title, :bgcolor, :font,
:description)
  end
end

When I am trying to render params for user_preference I am getting only
title and description

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/054ed4f66a3ee22ad212fcc7acd9a486%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to