ruby-on-rails

Return a JavaScript's confirmbox response to a ruby program.

Hi all, Sorry if it looks stupid question but is it possible to return the response from a JavaScript confirmbox or messagebox to a ruby program as a value? I click on confirmbox's "yes" button, this response is stored in a variable, and then this variable is returned to ruby? ...

Find your way up the polymorphic tree to one parent..

I have a simple polymorphic association #comment.rb belongs_to :commentable, :polymorphic => true has_many :comments, :as => :commentable #post.rb has_many :comments, :as => :commentable accepts_nested_attributes_for :comments, :allow_destroy => true So in IRB I can do, Post.comments, or Commen...

rails 3 test case error.on(:field) Vs. errors[:field]

I am working on the Rails 3 Test cases . While writing case i got Deprecation error like DEPRECATION WARNING: Errors#on have been deprecated, use Errors#[] instead. Also note that the behaviour of Errors#[] has changed. Errors#[] now always returns an Array. An empty Array is returned when there are no errors on the specified attribute...

rails' utc_to_local and daylight savings time

> e = Event.first > e.registration_start_utc #registration_start_utc is a datetime column => Sat, 23 Oct 2010 06:38:00 UTC +00:00 > e.registration_start_utc.utc? => true > ActiveSupport::TimeZone.find_tzinfo("America/New_York").utc_to_local(e.registration_start_utc) => Sat, 23 Oct 2010 02:38:00 UTC +00:00 2 questions about this: ...

has_many :through and acts-as-taggable-on

How can I get all the tags for a model's associated models using acts-as-taggable-on? I have the following models, and want to build a list of tags that the network's associated offers have: class Network < ActiveRecord::Base has_many :offers end class Offer < ActiveRecord::Base acts_as_taggable belongs_to :network end How d...

I can use dynamic find_by_* methods in rails, such as Company.find_by_name_and_zip_and_phone, but how can we use a multipart property in it?

Hi, I can use dynamic find_by_* methods in rails, such as Company.find_by_name_and_zip_and_phone, but how can we use a multipart property in it? Such as the update_at property, when I try to use Company.find_by_name_and_zip_and_phone_and_update_at, i got an error: NoMethodError: undefined method `find_by_state_and_name_and_phone_and_up...

How to work with Sqlite?

I want to setup different rails versions with RVM. However, working with the SQLite gives problem. First, doing gem list -ra sqlite gives *** REMOTE GEMS *** sqlite-foreigner (0.5.0) sqlite-ruby (2.2.3 ruby mswin32, 2.2.2 ruby mswin32, 2.2.1 ruby mswin32, 2.2.0 ruby mswin32, 2.1.0 ruby mswin32, 2.0.3) sqlite3 (0.1.1, 0.1.0, 0.0.8...

use field that does not exsit in the model in the erb file

Hi , My model User contains only field hashed_password but not password and confirmed_password, which are requested to provide when registering. How should I write the view in this case? Following code will generate error Model User does not respond to password. 17: </div> 18: <div class="field"> 19: <%= f.label :password %><br...

Rails installation fails in netbeans 6.9.1 IDE, in Ubuntu ?

I,m getting the following error:- ERROR: Error installing rails: i18n requires RubyGems version >= 1.3.6 These the gems and ruby version installed in my system. :~$ ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] :~$ gem -v 1.3.7 :~$ rails -v Rails 3.0.1 :~$ ...

Can I work with rails3 in Windows with NEtbeans IDE ?

I believe that rails 3 support for windows is not released yet. Can I use Netbeans IDE and start working with Rails 3 in windows operating system ? ...

RESTful Rails Put/Post fail problem

So using Rails' REST resources routing, we end up with auto-generated routes that coordinate with Controller actions (I'll refrain from ranting about how I've replicated models twice, as well as relationships twice (as models and then as (often) nested resources; as well as actions twice (as I limit my resources with onlys/excepts where ...

Add number of records in belongs_to relationship in Rail app?

Hi Everyone? I have a Rails simple application that has two main models. A person model and a gift model. Gifts belong to people, and people have many gifts. I am currently (in the people index view) listing all people in the database with the following code: <% for person in @people %> <li><%= link_to h(person.name), person %></li> <...

ruby on rails rake db:migrate error

hi , i'm starting to learn ruby on rails using this guide : getting_started , i created my project and database but when i run rake db:migrate i get this error: @mona-Extensa-5230:~/rubyDev/Sites/blog# rake db:migrate (in /home/mona/rubyDev/Sites/blog) == CreatePosts: migrating =================================================...

Heroku install: missing gem isn't missing

Trying to deploy an app to Heroku -- first time app and deployment -- and keep getting the following error when I'm trying to migrate the db: Missing these required gems: authlogic You're running: ruby 1.8.7.253 at /usr/ruby1.8.7/bin/ruby rubygems 1.3.7 at /home/slugs/327637_0db78d3_8f84-7ba6678a-ff5d-4646-8320-f58c88156465/mnt...

Rails 3: Disable session cookies

I created a controller to serve dynamic stylesheets, so I can use the image_tag helper and add some cache control. The problem is that every time the css file is loaded at the browser, I can see 'Cookie xxx changed" message in firebug. I would like to disable or bypass session cookies for this controller. I read somewhere that using ...

A/Bingo not writing conversions correctly?

I'm using A/Bingo for Rails, and it seems to be working fine, except for counting conversions. It looks like conversions for the first user that converts are counted, but then it gets stuck and doesn't record any other conversions. I know that conversions occurred because I see them in two completely separate and unrelated analytics apps...

Is it possible to integrate OmniAuth and Facebooker together ?

Hi I'm want to use ruby on rails to create a facebook connect web site with full facebook integration (events API) can I use OmniAuth for authentication and facebooker to handle the facebook API together ? Is facebooker up to date with the latest API changes in Facebook ? Can you recommend any good articles about the subject ? Thanks G...

AWS S3/Ruby on Rails/ heroku: Security hole in my app

I have a route in my config which says that for a page, say /secure, there is a login required (done via authlogic). A before_filter in my controller takes care of that. That works fine, the page and its resources have restricted access - through the application. Trouble is, we are using Amazon S3 for storage on this app (based on refin...

I have multiple accounts each its own users, and want the users email address to only be unique per account

Hi, I am using rails to build a web app which provides each business with its own account and subdomain, Similar to how basecamp (and other 37 signals apps) lighthouseapp.com, and so on. Now I know that there are lots of decent tutorials on how to do subdomains in rails, and even the subdomain-fu plugin. The thing is that I want to us...

Heroku App launch timed out...HELP!!!

Apps been working GREAT. Installed the heroku-sendgrid-stats plugin and redeployed. App wouldn't start. Uninstalled the plugin, pushed to Heroku..."App Crashed". Created a suport ticket, but no reply yet. I'm stumped and my app's been down for 12+ hours...ANY guidance is GREATLY appreciated. App is using MySQL via Amazon RDS...whi...