Tag Archives: ruby on rails development

Bootstrap 3 with Rails 4

Refer the blog http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/ In the downloaded bootstrap archive you will see a ‘dist’ folder which will house the css, javascripts, and fonts folders we will want to copy to our Rails application vendor/assets/ directory. bootstrap/dist/css/bootstrap.css and bootstrap/dist/css/bootstrap.min.css to vendor/assets/stylesheets … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | Leave a comment

Custom rake task

Task to add Indian states to spree database. 1) Add a text file with extension .rake to the folder lib/tasks/ example:-lib/tasks/mytask.rake 2) add file content as follows task :add_indian_states=>:environment do CSV.foreach(“lib/tasks/states.csv”) do | row | state, abbr = row Spree::State.create(:name … Continue reading

Posted in rails, ruby on rails, web development | Tagged , , , , , | 5 Comments

Rails API

1) follow  railcast no:-348 In /public/index.html file use function addTask as the following way instead of described function addTask(ta) { $(‘#tasks’).append(‘<li>’ + ta.task.name + ‘</ul>’); } Reference 1) http://railscasts.com/episodes/348-the-rails-api-gem?view=asciicast 2) https://github.com/rails-api/rails-api 3) http://davidsulc.com/blog/2011/04/10/implementing-a-public-api-in-rails-3/   Securing a API  ( but not … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | 1 Comment

what is rails templates ?

generators can be used inside an application, they can also be used to generate applications too, This kind of generator is referred as a “template”. example gem(“rspec-rails”, :group => “test”) gem(“cucumber-rails”, :group => “test”) if yes?(“Would you like to install … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | Leave a comment

REST show action :- using other field data

show action use primary key “id” for displaying a particular record. if want to use other filed data as the link /welcomes/john ( where welcomes is the controller and john is the value in the name field ) In the … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment

Polymorphic Associations in rails

  Refer above figure and tables products,employees and pictures With polymorphic associations, a model can belong to more than one other model, on a single association 1) In Picture model want to mention as follows class Picture < ActiveRecord::Base belongs_to … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment

The has_one :through Association in rails

  Refer above figure and the tables suppliers,accounts,account_histories A has_one :through association sets up a one-to-one connection with another model. 1) In Supplier model want to mention as follows class Supplier < ActiveRecord::Base has_one :account has_one :account_history, :through => :account … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment

Many to one relationships

Refer above figure and tables books and chapters Here one book contains many chapters ( one to many) For this rails requires  a foreign key and it goes to the table chapters while code 1) Foreign keys in Rails should … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment

using blueprint/basic with compass in rails 3.1.2

1) Add the compass-rails gem line to a group called :assets in your application’s Gemfile and bundle 2)bundle exec compass init rails –using blueprint/basic 3) copied app/stylesheets contents to app/assets/stylesheets 4) do as usuall with blueprint and with compass http://www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , | Leave a comment

create great looking, cross-browser compatible buttons in rails using compass extension named Sassy buttons

1) gem install sassy-buttons 2) add it to gem file and bundle gem ‘sassy-buttons’ 3) Import Sassy Buttons partial into your scss/sass file and use the mixin as the follows @import “compass/css3/border-radius”; @import “sassy-buttons”; #fir { background-color: red; @include border-top-left-radius(25px); … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , | Leave a comment