ruby-on-rails

Integrating twitter,facebook and other services in one single site

Hi all, I need to develop an application which should help me in getting all the status,messages from different servers like Twitter,facebook etc in my application and also when i post a message it should gets updated in all the services. I am using authlogic for authentication. Can anyone suggest me what gems/plug-ins i can use.. I n...

Populate Two Columns in single collection_select Rails

View <%= collection_select(@table, "sp", @pops, "col2", "col2", {:prompt => "Select one"}) %> Controller @pops = Table.find(:all, :conditions=>{:col1 => "xyz"}, :order=> 'col2', :select=> 'DISTINCT col2') This is my existing code. I am collecting a values in a column2 and populating it. Existing populating values as (col2a,col2b,co...

devise routing error

I can't seem to get past this error when setting up devise. Routing Error wrong constant name Devise/registrationsController or Routing Error wrong constant name Devise/sessionsController I'm using Ruby 1.8.7, Rails 3.0 and Devise 1.1.3 Everything else on my app works, I recently upgraded my app from 2.3.8 and was previously usi...

Dynamic combo collection_select rails

Dear All, I am using two collection_select Views <%= collection_select(@table, "gm", @strs, "country", "country", {:prompt => "Select Country"}) %> <%= submit_tag value="Proceed-->"%> <%= collection_select(@table, "sp", @pops, "state", "state", {:prompt => "Select State"}) %> <%= submit_tag value="Submit"%> Controller @strs = T...

Rails 3 - Getting NameError after accessing models via has_many

Hey folks, I have following models: class App::Module::Object < AR::Base has_many :objects, :class_name => 'App::OtherModule::Object' end and class App::OtherModule::Object < AR::Base belongs_to :object, :class_name => 'App::Module::Object' end Using Rails 3.0.0 and Ruby 1.9.2, I get following error after accessing App::Module...

Sequel::AdapterNotFound while trying to run Ruby On Rails application

Hello everyone. This is my first question asked here so I apologize in advance if I break any rules. I'm trying to get a project going on my system, I have imported the source code via GITHub, and are running it locally with WEBrick. When I do, the following error is printed: => Booting WEBrick => Rails 2.3.8 application starting on 0....

named_scope error on belongs_to association

I am getting a named_scope error, am i trying to use it incorrectly? class Owner < ActiveRecord::Base has_many :dogs named_scope :is_fit?, :conditions => { :age => 16..40 } end class Dog < ActiveRecord::Base belongs_to :owner def is_owner_fit? owner.is_fit? end end undefined method `is_fit?' for #<ActiveRecord::Associ...

Find memory leak in a Ruby on Rails project

I have a Ruby on Rails project with what seems to be a memory leak. It keeps using more and more memory until it crashes. Dumping the amount of objects per class using ObjectSpace I've found this: Name Count ---------------------------------------------------------------------...

How to automatically add tags to plain text data?

i'm making a recipe database, but i want a table for ingredients and for actions (i.e whisk) and when a user submits the plain text instructions i want it to wrap those keywords with div tags. is there a similar app that does something like that? ...

How to make Urls in Rails seofriendly

How can i realize seo friendly urls? Instead http://mysite.com/articles/show/2 i would like to use the articlename instead the id i.e. mysite.com/articles/show/articlename or somehow combine id and articlename like this mysite.com/articles/show/articlename-2 i'm a rails newbie so perhaps you could give me short advice where ...

Rails beginner, initialize object

In rails default controller the new method makes an object, and the create method is used later to save that. I want to set a mod_user field in the DB, without it being input into the form. Based on this link http://api.rubyonrails.org/classes/ActiveRecord/Base.html I've tried adding the following to my pages controller. def new ...

Rails: create on belongs_to association

Hi (huge Rails newbie here), I have the following models: class Shop < ActiveRecord::Base belongs_to :user validates_uniqueness_of :title, :user_id, :message => "is already being used" end and class User < ActiveRecord::Base has_one :shop, :dependent => :destroy end When I'm about to create a new shop, I get the following error: p...

Migrating from Authlogic to Devise

I've previously implemented Authlogic for authorization on my site. Now however I wish to switch over to using Devise instead, and I'm wondering if anyone has any experience with this. Perhaps anyone's seen a blog post on the subject? Thank you. ...

dynamic validates_length_of

Hi all, I' trying to do a validates_length_of, but specifying the range/minimum/maximum at run time. For instance, we have a parent model: class Parent < ActiveRecord::Base has_many :children # with attributes min_length, max_length end And a child model: class Child < ActiveRecord::Base belongs_to :parent # with an attrib...

Format Text Going Into A Textbox for a Phone Number, etc.

Hi There, Couldn't find this anywhere, maybe I'm looking for the wrong verbs. I'm trying to get a textbox to require a certain format as you type in a number. For simplicity, lets use a phone number example. As I type into the box I want some guidelines to help the user enter the correct format of the phone number: (4__) ___-____ ...

Rails 3 - polymorphic_path - How to Create One given a table

Hello, i have table AuditLog with fields including: audited_id | audited_type That results in data like: 108 | Photo 303 | Comment What I want to do is create a link to the item, so for the example above: here is the photo I'm trying to use a polymorphic_path but am getting an error: "undefined method `model_name' for Fixnum:Class" ...

How to deploy a [Ruby on Rails] site in a scalable way?

I have been working on my [first] startup for a month now, and while it's probably atleast one more month away from an alpha release, I want to know how to deploy it the right way. The site will have an initial high amount of load (network + CPU) for a new user, so I am thinking of having a separate server/queue for this initial process,...

Mysterious mixed content warning - it appears to all be https with no http?

Hi all. I have an https page which launches a shadowbox which itself has a page inside it. The shadowbox content is got with whatever protocol the parent page is, so loads with https as well. When the shadowbox page loads I get a mixed content warning, saying that some parts are not encrypted. Usually this happens when some of the ...

RoR + How to refresh javascript value when Ajax refreshes the textbox value

In my webpage, I am using ajax + RoR to refresh the contents of the textbox using searchtool. All the value i am accessing, such like superset value for the current page. Means for example there is headquater and it has many stations. When I am trying to access the value of headquater at station then corresponding values changes at textb...

Ruby on Rails - How do I render an action without the application layout?

Hi, I have a rails app and I want to render an action without using my application layout (which has page header / footer stuff in it). How could I go about doing this? ...