• Change file_field_tag appearance

    Change file_field_tag appearance

    Change file_field_tag appearance   HTML: <span class=”btn btn-large btn-warning btn-file”> Choose File <%= file_field_tag :attachment %> </span> CSS: .btn-file { position: relative; overflow: hidden; } .btn-file input[type=file] { position: absolute; top: 0; right: 0; min-width: 100%; min-height: 100%; font-size: 100px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; background: white; cursor: inherit; display: block; } Read more

  • Ruby on Rails: putting class with submit_tag

    Ruby on Rails: putting class with submit_tag

    Ruby on Rails: putting class with submit_tag <%= submit_tag(“Update”, :id=>”button”, :class=>”Test”, :name=>”submit”) %> First parameter is required and it would be value and they any parameter you want to specify, can be done in a hash like :key=>”value”. Read more

  • How to stop event propagation with inline onclick attribute?

    How to stop event propagation with inline onclick attribute?

    stop event propagation SO we will stop propagation at that point so that click will be performed for one div. Sample Code- <!DOCTYPE html> <html> <head> <title>Check Out Propagation</title> </head> <body> </div> </div> <style type=”text/css”> #third{ height: 300px; width: 300px; background-color: black; } #outer{ height: 200px; width: 200px; background-color: red; } #inner{ height: 100px; width: Read more

  • 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

Advertisements