Posts

Showing posts from 2015

How to get a text box value while press Enter Keyboard?

Image
1. index.html      <!DOCTYPE html> <html> <body>     <input id="test" type="text" />     <div>         <ul id="view">         </ul>     </div> </body> </html> 2.  JS $(document).keypress(function(e) {     if(e.which == 13) {         alert("Welcome");               $("#test").val();         $("#view").append($("#test").val());     } }); OUTPUT

Setting Up User Authentication With Devise

I am starting work on a new application .  I wanted it to have multiple users, but I didn't want to reinvent the wheel, so I decided to use a pre-existing gem called Devise.  I am on a Mac using Ruby 2 , 3 and Rails 4. Add Devise If you want to run Bootstrap and/or Simple Form on your app, please follow the instructions on my blog post  Bootstrap Your App  before proceeding. I selected Devise simply because it was the most popular  Rails Authentication gem at The Ruby Toolbox  and I wanted to try it out. Add the  devise  gem to your  Gemfile: Gemfile 1 gem 'devise' Next run install: 1 $ bundle install Taking a look at the  Getting Started  documentation, I followed the next steps. Run the generator: 1 $ rails generate devise:install Doing this also resulted in some intructions from Devise that I followed. I first defined the default url options in  config/environments/development.rb  by adding this line: confi