ruby-on-rails

Stack Level Too Deep in Production Rails App - How to Get Details?

Hey, I am getting up and running with Spree in production on a 256MB Slicehost slice with MySQL, Mongrel, and Nginx. I am getting this error every time I try to access any URL in the app: SystemStackError (stack level too deep): compass (0.8.17) lib/compass/app_integration/rails/action_controller.rb:7:in `process' vendor/plugins/...

How to ping pingomatic.com with XML-RPC from a Rails app

I want to automate sending pings to rpc.pingomatic.com but I can't find anywhere which documents the fields to send in the RPC document. I'm not worried about a fancy RPC generator. I'm happy just to #{...} the link into a static string. I just need to know what to insert it into. ...

A book about RoR for the Ruby illiterate?

Is there a book about RoR for someone that has little or no understanding of Ruby? Although RoR is a great reason to start learning Ruby, I'd be bored out of my pants if I first have to read a full book on Ruby and then a book about RoR. Something that demonstrates the basic principles of both Ruby and RoR would be an ideal intro to th...

Troubleshooting: Rails can't save to database in production?

I could use a little help trouble shooting this problem. When using the app to create a new record nothing is being saved to the database. There are no visible errors presented. Dropping to the command line, and using the console with the same production environment, I can create a new object and save it (I have to bypass validations)....

How can I display the correct created and modified times in my webapp?

I'm working on a Rails application that's kind of like a blog. Users create Entries. I'm trying to work out how to handle time storage and display. I've read this writeup about Rails timezone support. It's great but it doesn't cover what my app needs to do. It only looks at cases where you want to convert stored time to the current logg...

Rails: Do the benefits of using resource based routing to create RESTful controllers outweigh the additional complexity?

I am building a web application using Rails and my first instinct was to make all the controllers RESTful. In particular, I am using the PUT method for any actions that modify data. But this seems to add unnecessary complexity for a browser-based app because Rails uses Javascript to wrap the URL in a POST request. Secondly, it means ...

rails best way to receive xml data from flex application

Hi everybody, Can anybody give me any hints on that? I'm able to display xml content on my swf file but how can I send the changed xml file back to my rails Server? Thanks in advance! Markus ...

Use ActiveRecord to Find Result of 5 Nested Tables

I have a User Model(:name, :password, :email), and Event model(:name, :etc) and Interest model (:name) Then I created two join tables -> UsersInterests and EventsInterests; each not containing a primary key and only comprised of the user_id/interest_id and event_id/interest_id respectively. I'm trying to use ActiveRecord to query a lis...

Handle version conflict when multiple concurrent editor on the same model rails

how to Handle version conflict when multiple concurrent editor on the same model rails? for example user A click edit on the post controller and start editing the content user B click edit on the post controller and start editing the title user B is done and click save user A is done and click save and override the modifications done by...

Passenger+nginx: Hosting a Rails application in a subdirectory

I'm trying to deploy an application in a subdirectory /a under www.myserver.com, following the steps in the Passenger docs here: http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri This seems to work, but the Rails routes are now all expecting the additional subdirectory /a, such that trying to access the...

how to create scaffolding for model that is already in place

I have a model already in place. I just want some admin screens created for it which will do the add/edit/update/delete functionality. My model name is User and it has properties user_id, first_name, last_name, user_status, created_at, updated_at, updated_by Is it possible to use the script/generate scaffold on this model so that cr...

How to get custom form fields from controller -- a.k.a. how to not use date helpers in form

I created a form with scaffold that includes two datetime fields. I replaced them with a datepicker, and now I'm trying to grab the date from within the controller. Instead of having ruby do all the magic work with the datefields, I instead just have to fields, start_date and stop_date that I want to use, but I can't figure out how to g...

Rails - conditions for find

@people = Person.find(:all, :conditions => ['parent_id = :parent_id', params[:person]]) I would like to integrate an age range condition based on birthdate as well. I figure in the model I can write something like: def minimum_age_conditions ["people.birthdate <= ?", Date.today - minimum_age.years] unless minimum_age.blank? end de...

Embed vimeo player in Rails?

I want to allow users to submit a vimeo url and embed that in a player. Is there a plugin or gem that does that? Thanks ...

Help me with this sanitize vimeo embed code

Here's the vimeo url code. <object width="40" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9082619&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&am...

Ruby on Rails interactive spreadsheet via prototype/script.aculo.us

Houston we have a problem: I have a table with drop_receiving divs inside cells. And i have set of draggable widgets - divs also. I need to call methods of my controller onDrop with sending drop_receiving div id and widget id to it. P.S. I think in future only ids of divs are not enough, but now i want to understand how to make Ajax req...

How to generate a select box by using options_from_collection_for_select

Hi, I am really confused with select boxes in ROR. How can I generate a working select box by using options_from_collection_for_select. This will only generate the option tags and not the select tag? Can anyone please provide me an example on how to use this. I am having a hard time understanding select boxes, I don't know why... Than...

ruby on rails - wrong number of arguments (0 for 1) when using 'form'

Showing app/views/frontend/get_months.html.erb where line #1 raised: wrong number of arguments (0 for 1) Extracted source (around line #1): 1: <%= render :partial => "months", :locals => {:form => form} %> RAILS_ROOT: /rails_workcopy/er_spending_report My get_month.html.erb has only one line of code. if i use <%= form.select(...) %>,...

Rails validation for a has_many association

I am having trouble with validations on a has_many relationship where the children exist, but the parent doesn't. However, when creating/saving the parent object, I want to ensure that specific children (with certain attributes) have already been saved. There is a Parent object that has_many Child objects. The Child objects are persiste...

Custom ActiveRecord finder invoking named scopes?

I have a custom finder defined below: class ContainerGateIn << ActiveRecord::Base ... def self.search(text) result = if text text.split(' ').inject(self) do |result, criteria| case criteria when /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ result.search_by_date(criteria.to_date) else r...