On 21 April 2015 at 17:25, Manish K. <[email protected]> wrote:
> I am using rail 4.2 and ruby 2.2.0p0, I need to submit form which
> belongs to user table, once the user authenticate and for authentication
> I am using devise, Do I need to create user controller and view manually
> or
>
> I have created two directory named as my_devise one under controllers
> and other under views. I followed this for the approach which I took. I
> am getting "uninitalized constant MyDeviseController" error.Here is the
> list of files which I modified.

Post the complete error message and tell us which line of code it refers to.

Colin

>
> my_devise/registrations_controller.rb
>
> class MyDevise::RegistrationsController <
> Devise::RegistrationsController
>
>  def update
>     @user = current_user
>     if @user.update_attributes(user_params)
>       # Handle a successful update.
>     else
>       redirect_to 'my_devise/registrations'
>     end
>   end
>
>   private
>
>     def user_params
>       params.require(:user).permit(:title, :font, :description,
>                                    :bgcolor)
>     end
>
> end
> my_devise/registration.html.erb
>
> <%= form_for :user, @user, :url => url_for(:controller =>
> 'registrations', :action => 'update') do |u|%>
>  <br >
>  <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>
>   <hr >
>   <div style="background: #{current_user.bg_color};"></div>
>   <div style="background-color:#{current_user.font.nil? ? '#FFFFFF' :
> current_user.font}">
>     This is the changes made in background
>   </div>
>
> <div style="background-color:#{current_user.bgcolor.nil? ? '#FFFFFF' :
> current_user.bgcolor}">
>
>   </div>
>
> <% end %>
>
> routes.rb
>
> devise_for :users, :controllers => {:registrations =>
> "my_devise/registrations"}
>   devise_scope :user do
>     authenticated :user do
>       root :to => 'my_devise#registration', as: :authenticated_root
>     end
>     unauthenticated :user do
>       root :to => 'devise/registrations#new', as: :unauthenticated_root
>     end
>   end
> schema.rb
>
> ActiveRecord::Schema.define(version: 20150420060137) do
>
>   create_table "users", force: :cascade do |t|
>     t.string   "email",                  default: "", null: false
>     t.string   "encrypted_password",     default: "", null: false
>     t.string   "reset_password_token"
>     t.datetime "reset_password_sent_at"
>     t.datetime "remember_created_at"
>     t.integer  "sign_in_count",          default: 0,  null: false
>     t.datetime "current_sign_in_at"
>     t.datetime "last_sign_in_at"
>     t.string   "current_sign_in_ip"
>     t.string   "last_sign_in_ip"
>     t.datetime "created_at"
>     t.datetime "updated_at"
>     t.text     "title"
>     t.text     "font"
>     t.string   "bgcolor"
>     t.text     "description"
>   end
>
> --
> 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/a3a889866dcaf55a63f11af1c9bc8a30%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAL%3D0gLvTGTKBE4ccu%3D2b%3DN2DDv09_M_CPqe2kb7WD2ZWnMNYSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to