ruby-on-rails

Ruby on Rails ajax - dynamically loading all pages

I have a flash media player (similar to lala.com) that needs to continue to stream while people click around. I don't want to use an iframe. So, I need to dynamically load all site pages with ajax no matter what link people click on. I've got this working with Rails and JQuery for a single page. With this method I have to place a file....

how to save data to two models from one form

I have a scenario where I would like to save data to two models from one form. Basically I have a player which belongs to many teams. So in the new action of players_controller I'd like to have a multiple select box that contains all the teams. then the user can select 2 or 3 of them..click save and they will be saved. player belong...

How can I disable logging in Ruby on Rails on a per-action basis?

I have a Rails application which has an action which is invoked frequently enough to be inconvenient when I am developing, as it results in a lot of extra log output I don't care about. How can I get rails not to log anything (controller, action, parameters, complection time, etc.) for just this one action? I'd like to conditionalize i...

How to update data in page after redirect

On the change of a 'select', I'm calling a method in my controller, 'get_sched'. That method just sets a couple variables, then I do a redirect with: respond_to do |format| format.html { redirect_to :action => "index", :id => params[:id] } end My log shows that it's redirecting, but the data on my page isn't updating. Do i need to d...

Selecting a value from the select box when options added by an ajax call

Hi, I have a form to add recipes, in the same form the user can add multiple recipe ingredients. Every ingredient the user adds is done by an ajax call, this way I don't have to display a select box of ingredients. When the user user select's an ingredient the id of the selected ingredient is stored in a hidden input <%= builder.hidd...

validating fields, validating associated models, and the order or error messages

Hi, I have a couple of questions on validations and I cannot figure out what to do. Any help is appreciated. I cannot seem to control the order of the error messages when they are display on the page. I have validates_associated attribute and it does validate the individual fields but it also adds a line which says "model name is inva...

Heroku vs EngineYard: which one is more worth the money?

I looked this up on Google, but wanted more opinions before I committed to either service. Has anyone had experience with either (or maybe both) services? Are there any advantages or disadvantages that stood out about either one? Particular areas of interest are: Security Stability Scalability. Price ...

Good Rails forum plugins

Hi. I am creating a rails app that needs to have a social-forum like behavior. Can anyone suggest a good plugin for rails that will let me build on top of it, without having to re-invent the wheel? Cheers ...

How can I determine/use $(this) in js callback script

I am using Rails and jQuery, making an ajax call initiated by clicking a link. I setup my application.js file to look like the one proposed here and it works great. The problem I'm having is how can I use $(this) in my say.. update.js.erb file to represent the link I clicked? I don't want to have to assign an ID to every one, then recomp...

rails, peridodic_call_remote, update form

I want to have a form saved every 10 seconds or so, or maybe onchange. I'm using rails and have tried observe_fields and periodic_remote_call, but I don't know how to send a full full parameter with periodic and how to send a full form with observer. ...

How to redirect a server call from a swf file to e rails environment

Hi Everybody, I have a problem with my SWF file integration. I am now able to load the SWF file and hand xml data over, in the SWF file I can change the xml data, and I can send them back to the Server. But my problem is, that the resulting redirection doesn't have any effect! I guess that the resulting page gets told to the SWF file an...

Overload and Bypass Active Record Update

I am trying to implement an audit trail into my application, but because of some requirements I am unable to use any existing gems or plugins. I would like to divert any normal attempt to update a model to a custom method that saves all the updates in another separate Table (called Updates). The application then uses the update table t...

can i ignore asp files in rails static folder?

i want translate old asp site to rails. old site has mixup code and static file in one big tree like . .. blabla/ -img/ --aaa.jpg -js/ --aaa.js blabla.asp blabla2/ -img/ --aaa.jpg -js/ --aaa.js blabla2.asp it's big site and still replace static files. and i didn't want sync issue. so i do ...

Mootools + Ruby on Rails == ?

I just wonder if there is any chance to integrate Mootools into Ruby on Rails with working helpers like remote_function() or page.replace() ? ...

Is Authentication between a PHP section and a Rails Section of a website possible?

The site is currently written in PHP. I want to add a new component by doing it in Ruby on Rail and then installing Rails in a sub-folder. If a user logs in the PHP portion of the website, can I customize the content for him/her in the Rails section without requiring a second login? I'm relatively new to Ruby on Rails so that's why I'm...

Rails: has_many, but also has_one by a different name

Let's say a User has many Documents, and a single Document they're currently working on. How do I represent this in rails? I want to say current_user.current_document = Document.first (with or without current_ in front of document) and have it not change the current_user.documents collection. This is what I have: class Document < Acti...

How to send a dynamically generated file in a rails app

I'm trying to serve a dynamically generated files in a rails app, so when the user clicks a specific link, the file is generated and sent to the client using send_data. The file is not intended to be reused: is a short text file and regenerating should be really inexpensive as it won't be donwloaded that much; but if it is necessary or ...

Why is Rails encoding slashes for catch all (splat) routes?

When using a catch all route the URLs have the forward slash encoded as %2F which means I can not lookup a record using request.path map.document '*path', :controller => 'documents', :action => 'show' Page.find_by_permalink('/blog/my_first_post') # Record found Page.find_by_permalink('blog%2Fmy_first_post') # Record not found Firstly...

How can one obtain a row count from has_many :through relations with :uniq => true

This is my model: class Tag < ActiveRecord::Base # id, name has_many :taggings end class Tagging < ActiveRecord::Base # id, tag_id, owner_id, target_type, target_id belongs_to :tag belongs_to :owner, :class_name => 'User' belongs_to :target, :polymorphic => true validates_uniqueness_of :tag_id, :scope => [ :target_id, :ta...

Nested iframes in Rails/Facebooker app when using Internet Explorer

(I know there's been a similar question here: http://stackoverflow.com/questions/1474817/getting-nested-iframes-with-facebooker-in-iframe-app, but that fix didn't seem to work) I'm currently developing a Facebook iframe app in Rails using the Facebooker plugin. However, I'm getting some weird cross-browser incompatibilities. The app wor...