ruby-on-rails

Rails : NoMethodError (undefined method `submitting' for []:Array)

NoMethodError (undefined method `submitting' for []:Array): haml (2.2.0) lib/sass/plugin/rails.rb:19:in `process_without_compass' compass (0.8.17) lib/compass/app_integration/rails/action_controller.rb:7:in `process' /usr/local/lib/ruby/gems/1.8/gems/hoptoad_notifier-2.3.6/lib/hoptoad_notifier/rack.rb:27:in `call' getting error...

What is the significance of the dispatch.fcgi file in Rails

Hi, There is a file under public folder in Rails environment called dispatch.fcgi. What is the significance of this particular file? I opened that file and it has this # # Default log path, 50 requests between GC. # RailsFCGIHandler.process! nil, 50 # # # Custom log path, normal GC behavior. # RailsFCGIHandler.process! '/var/l...

avoiding iframes, but having some iframe like activity in Rails

I have two sites, my main site and a help site with documentation. The main site is rails but the other is simple a wordpress like blog. Currently I have it being pulled into the main site with an iframe, but is there a good way to pull in the html from the other site as some sort of cross-domain (sub-domain actually) partial? Or shou...

simple captcha issue in ROR

I have the rails application, when i register the user i used simple captcha, the issue i faced is simple captcha stored image text value in database which is not equivalent to form display captcha value. so i couldn't submit the form even i typed the correct text. i found the problem root cause. but i don't know how to synchronize the d...

RoR: Listing of subrecords

Schema: persons (id, name, birthyear, gender) pets (id, person_id, name, leg_count) plants (id, person_id, kind, qty) I would like to make a read-only report about these things grouped by persons. The listing of personns is done (without the associated records). I would like to have "subtables" per persons. Something like: Persons +...

Phusion Passenger error on image uploading

Hi All, I am having an ROR application deployed on server, it is throwing the following error on server when user uploads an image: > ActionController::RoutingError (No > route matches > "/images/<image_name>.png" with > {:method=>:get}): passenger (2.2.15) > lib/phusion_passenger/rack/request_handler.rb:92:in > `process_request' p...

how to convince my manager for a rails 3 upgrade | should I upgrade to rails 3

We are currently running rails 2.1. My main motivation for the upgrade is the fear that gems/plugins will get rarer/unavailable/unsupported day by day for our version (,and the excitement of the latest technology). I understand there are many-many improvements that come with rails3, but probably what my manager would want to listen is ...

Problem with Rails 3.0.0 and Ruby 1.8.7? Sporadic 'wrong number of arguments' error

I'm using Rails 3.0.0.rc with Ruby 1.8.7 on Snow Leopard. I was using Builder to to restrict what's returned by render :xml for a User model object. It wasn't working as expected, so I commented out my format.xml block. E.g., this was my users_controller.rb: def create # TODO: Limit the frequency at which this can be called. ...

Factory_girl or machinist?

Are you using factory_girl or machinist for stubbing/mocking in Rails tests? ...

adding new routes and actions to restful resource in rails 3

Look at these stackoverflow urls. [1] http://stackoverflow.com/questions [2] http://stackoverflow.com/questions/tagged/ruby I need to achieve exactly this. I have a resource called questions with RESTful routes defined as follows. resources :questions do end I have a tagged action in my questions_controller which takes in a paramet...

ActiveRecord doesn't work on one table

I have a Rails Model: ruby-1.9.2-p0 > NavItem => NavItem(id: integer, item_identifier: string, description: string, description2: string, packing_unit: string, sales_unit_of_measure: string, ean_code: string, evp_price: string, item_category_code: string, class: string, product_group_code: string, maintenance_status: string) If I wa...

On Ruby on Rails' script/console, is there a way to print out all the models in your app? (all ActiveRecord subclasses)

which is to find out all the Models in the app. This can be found out from the project folders / filenames, or in the route.rb, but just wonder if there is a Ruby way of finding it out on script/console? ...

Where to put Ruby scripts for script/runner on a Rails project?

I have seen examples where it is put in the lib folder, and another example in the app folder. Is there standard place where it should be put for Rails 2.3.8 and Rails 3 convention? ...

Setting Symbols in Form View - Ruby on Rails

I am having problems trying to set symbol values in a form view. My view has a couple instance variables being used, @task and @team, @team is the one im having issues with. Tasks have a :team value that needs to be set. In this view @team holds a value, but when I hit the "Create" button and make a post, the @team value is lost, and ...

Using the jQuery star rating plugin with Rails

Hi, I'm in the process of integrating the jQuery star rating plugin with Rails. I've written the Rails server-side code and have sorted the submission of a new rating, but at the moment I'm struggling to figure out how to display the average rating value as a static series of stars using the plugin. Displaying the rating itself is fine:...

Overwrite ActiveRecord's save method to use custom interface

Hello, I got the following situation: I have a rails application and two databases, one is for the Rails Application and the second database (running on the same DB Server Instance) is for a different non-web application. My Rails Web Application may read from the (second) Database directly via SQL but it can't write to it because of ...

Need advice on MongoDB Schema for Chat App. Embedded vs Related Documents

I'm starting a MongoDB project just for kicks and as a chance to learn MongoDB/NoSQL schemas. It'll be a live chat app and the stack includes: Rails 3, Ruby 1.9.2, Devise, Mongoid/MongoDB, CarrierWave, Redis, JQuery. I'll be handling the live chat polling/message queueing separately. Not sure how yet, either Node.js, APE or custom Eve...

Advanced Routing with Rails3

I want to use regular expressions inside my routes. I have an Products controller, but I want a different URL structure to access the products http://host/this/ http://host/that/ http://host/andthat/ These URLs should call a action in my controller (Products:show_category(:category)) Is something like this possible? match "(this|th...

rails mailer with different layouts

I use one layout for all my emails in my Notifier model (20+ emails)... however sometimes I just want to send a plain text email with no layout or html at all. I can't seem to be able to figure out how? If I try to send a plain text email i still get the layout, and all the HTML in the email. I'm using Rails 2.3.8. I read about this ...

belongs_to has_many assosiation help.

I created a joined table for the models category and products (both created with scaffold). The Product model is this: class Product < ActiveRecord::Base belongs_to :category def category_id category.id if category end def category_id=(id) self.category = Category.find_by_id(id) unless id.blank? end end and the ca...