• Readmorejs::Rails (HOW TO?)

    Readmorejs::Rails (HOW TO?)

      Readmorejs::Rails Installation Add this line to your application’s Gemfile: gem ‘readmorejs-rails’ And then execute: $ bundle install Or install it yourself through terminal: Read more

  • Deploy Rails to Heroku

    Deploy Rails to Heroku

    Deploy Rails to Heroku Follow these 12 steps for deploying your app on heroku. Create a new Heroku account. In the terminal, log in using the email address and password of Heroku account: $ heroku login In Gemfile, add the pg gem to your Rails project. Change: gem sqlite to gem ‘sqlite3’, group: :development gem ‘pg’,… Read more

  • Create unique id in link_to tag rails

    Create unique id in link_to tag rails

    Create unique id in link_to tag rails <%= link_to “Edit”, edit_question_path(question.id),method: :get, :remote => true, id: “myBtn_#{question.id}” %> This is how you can create a unique id using #. id: “myBtn_#{question.id}”     Read more

  • Edit using ajax

    Edit using ajax

    Edit using ajax   Step 1: In your index.html.erb  Add :remote => true, :class => ‘class_name’ in app/views/controller_name/index.html.erb. Like this, Read more

  • Delete using ajax and fade out

    Delete using ajax and fade out

    Delete using ajax and fade out   Step 1: In your index.html.erb  Add :remote => true, :class => ‘class_name’ in app/views/controller_name/index.html.erb. Like this, <%= link_to “Delete”, question_path(question.id),method: :delete ,data: { confirm: “Are you sure?”}, :remote => true, :class => “delete_question”%> Step 2: Create a file, destroy.js.erb, put it inside folder .erb files (under app/views/controller_name). It should look like this: console.log(“here”) noty({text:… Read more

  • ArgumentError in class#create while applying Ajax.

    ArgumentError in class#create while applying Ajax.

    ArgumentError in class#create while applying Ajax. For these type of errors you must hav not initialized the vairiable with new keyword causing it to make a empty class.   <%@answer=Answer.new%> <%= form_for @answer, remote: true do |f|%> <%= f.text_area :content ,placeholder: “Write your answer”, :class => ‘a2’, required: true%> <br> <%= f.hidden_field :question_id , :value =>… Read more

Advertisements