WebyFI/RailsRocks
  • About
  • Contact
  • Portfolio

Paperclip, Multiple Image Uploads, Rails 2.3.4

By Dilloshion Raju On September 25, 2009 · Leave a Comment

Hello folks,

It’s been a while since I updated the blog and rails has changed a bit since then. I thought I’d revise one of my previous posts: the one about uploading multiple images using paperclip. This time we’re going to be doing it using Rails 2.3.4. I’m going to be using the paperclip gem, [...]

Continue Reading →

Drying up validations/dependency callbacks..a little

By Dilloshion Raju On February 2, 2009 · Leave a Comment

Have you ever had to write conditional validations in your model? Have you ever found your self repeating the condition across several validations? Would you like to dry this code up a little? Well, this is how you could do it.
Example verbose code:

validates_presence_of :field_one, :if => :my_ubber_condition? validates_length_of :field_two, :if => :my_ubber_condition? [...]

Continue Reading →

Rails update_all method

By Dilloshion Raju On January 15, 2009 · Leave a Comment

Sometimes we need to update all of the records in our table with some information. Lets say for arguments sake that we need to update the “pages” table and set the “name” column to a certain value for all rows. We might be tempted to do this a couple of ways.

The first approach:

@pages [...]

Continue Reading →

has many method not found error.

By Dilloshion Raju On January 4, 2009 · Leave a Comment

I’ve seen this mistake made quite a few times by new comers to rails and thought I would address it here, in case someone stumbles upon it looking for a solution. Let’s begin by creating a simple one-to-many association between two models.

#gallery.rb class Gallery < ActiveRecord::Base has_many :exams end #photo.rb class Photo < ActiveRecord::Base [...]

Continue Reading →

Loading data from CSV file.

By Dilloshion Raju On January 1, 2009 · Leave a Comment

Today, I would like to talk about adding data from an external file: example, from a .csv file. Lets say we have some info about “users” which we would like entered into the database. We can do this by using the fastercsv gem. Install it using ‘gem install fastercsv’. The format for such a [...]

Continue Reading →
← Previous Entries
  • Recent Posts

    • Paperclip, Multiple Image Uploads, Rails 2.3.4
    • Drying up validations/dependency callbacks..a little
    • Rails update_all method
    • has many method not found error.
    • Loading data from CSV file.
  • Tags

    Best Practice Callbacks Controllers CSV directory Dry Errors Multiple Image Upload Paperclip Rails Rake REST Ruby ShopStyle API Tips Validation Conditions Will Paginate
  • Categories

    • Rails
    • Ruby
  • Archives

    • September 2009
    • February 2009
    • January 2009
    • December 2008
  • Recent Comments

    • Blogroll

      • Cucumber
      • David Chelimsky
      • Jamis Buck
      • Josh Susser
      • Obie Fernandez
      • Peep Code
      • Pragmatic Programmer
      • Pratik Naik
      • Rails Api
      • Rails Envy
      • Rails Forum
      • Rails Inside
      • Railscasts
      • RSpec
      • Ruby
      • Ruby Forum
      • Ruby Inside
      • Ruby on Rails
      • rubylearning.com
      • Ryan’s Scraps
      • Scaling Rails

    WebyFI/RailsRocks

    Pages

    • About
    • Contact
    • Portfolio

    The Latest

    • Paperclip, Multiple Image Uploads, Rails 2.3.4
      Hello folks, It’s been a while since I updated the blog and […]

    More

    Thanks for dropping by! Feel free to join the discussion by leaving comments, and stay updated by subscribing to the RSS feed.
    © 2011 WebyFI
    Platform by PageLines