Customizing Ruby Gems

In the last two weeks I did not do a lot of work on this series, but I cleaned up a little bit, added some ajax and javascript as well as worked a little bit with css and style and also added user profile image and username to the user update section. Since I used Devise gem for user login and registration and Devise has a lot of functionalities and is very flexible. With Devise you customize user login and registration as you wish, here is how I added user profile image and username. first of all create a migration to added username and profile image, then in the application controller I added username and user profile as follow:

before_filter :configure_permitted_parameters, if: :devise_controller?
  protected
  def configure_permitted_parameters
	devise_parameter_sanitizer.permit(:account_update) 
{ |u| u.permit(:email, :password, :password_confirmation, :current_password, :username, :image) }
  end

Github is a very good resource for documentation. Any gem that you want to use, you can find useful documentation on how to use the gem in Github.

I also added ajax and javascript to the app so categories will be created by using a bootstrap modal. To do this there are several different gems available but selectize and select2 are the two popular one. for this application I used selectize that needs a little bit of ajax work.

get the full code form https://github.com/Atiqullah-Naemi/RubyonRailsCMS

If you just want to use the application open your command propmt and type:

git clone https://github.com/Atiqullah-Naemi/RubyonRailsCMS.git

once it is installed, just type:

rails db:migrate

after migration finished, type:

rails server

then open a browser and type ¬†“localhost:3000”

It is that simple, you are ready to use the application.

here is what I did in the last two weeks

Leave a Reply

Your email address will not be published.

Wordpress Social Share Plugin powered by Ultimatelysocial