top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to strip() all instance var of class instance in Rails App?

+1 vote
323 views

Something like x.instance_variables.each.... { |i} .... }

Thought to be a one liner. I can't figure out how to apply strip() to each variable, since instance_variable_get returns the value. I really want something I can apply .strip! to....

posted Jul 2, 2015 by Kaushik

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+3 votes

In the following code -

 require 'active_record'

 class Order < ActiveRecord::Base
 end

 order = Order.find(1)
 ...

As per http://api.rubyonrails.org/ find() is an instance public method. So why can we call Order.find(1) here? Shouldn't it be Order.new.find(1)?

0 votes

I have deployed a ruby on rails app on two instances of production server, now there are two separate log file are being created for different instances. My question is how I can make a single log file for both the instances?

+2 votes

I have a table with several thousand records in it. They take a long time to load and are essentially useless presented altogether.. I'd like present the user a search form to select a limited subset of records for display in the index function. What options are available to solve this problem and where might I look for examples or demos?

+1 vote

I want to create 3 rails apps in which every app has a Google API.
1) Gmail API
2) Google+ API 3
3) Google calendar API

Please suggest how to begin with...

...