Getting the SQL from a Rails Migration
Hi there, Does anyone know of a way to see the SQL that would be generated by a migration (preferably without actually running the migration)? Thanks! ...
Hi there, Does anyone know of a way to see the SQL that would be generated by a migration (preferably without actually running the migration)? Thanks! ...
I have a "jobs" model in my RoR project and i need the controller to access a table other than "jobs" in the database. Calling: @var = Job.find(:all) is not problem, but calling @var = TableB.find(:all) gets "undefined local variable or method `tableB'" for JobsController:Class Any ideas? Thanks! ...
I am using the great Thinking Sphinx plugin for accessing Sphinx Search in RoR 2.2.3. I have a cache table that stores pre-compiled views. This is the source data table for Sphinx. However, the ID column on this table is basically garbage, and the ID that I want is stored in another column (cacheable_id). How can I setup Thinking Sphin...
I'm attempting to create a facebook app and went through the book http://pragprog.com/titles/mmfacer/developing-facebook-platform-applications-with-rails. Everything works fine on my development machine when I have my canvas render method set as fbml. But, for various reasons I want to build an app with an iframe. When I set my app to...
I will have to use JDBC with an old database, which I why I selected jRuby. If I get a book on ruby on rails that does not include jRuby information, will that be benficial to me? ...
Spent a working day on this. I have class Box has_many :users, :through => :subscriptions end I also have custom insert_new_users and associate_with(new_users) methods which use multiple INSERT to do their job quickly. Anyway, they work fine. I also have this line at the end of "associate_with" method: def associate_with # mysql...
My selenium tests like to fails randomly. As an example I have this scenario Scenario: I should be able to edit a user Given I created a user with the login "[email protected]" And I am viewing the user with login "[email protected]" Then I should see "Edit this user" When I click "Edit this user" Then I should be editing the us...
Hi All, I've read many of the existing questions/threads on this subject, but keep in mind that none of them have directly addressed my issue. Also keep in mind that this is NOT a situation for database.yml as I won't know the DB info in advance. That said, I need a solution for DYNAMICALLY connecting to multiple databases in a Rails ...
flash[:notice] = t('flash.notice.order.creditcard.valid') I can sort of guess what this flash message probably outputs to the user but what is this 't' method and what kind of object is flash.notice.order.creditcard.valid? Is this application-specific logic or a Rails usage? ...
First Item I Want to validate a field to make sure it is unique (in the last 6 months) before saving it to the database. I am thinking I should use validates_uniqueness_of :field, case_sensitive => false, Scope => ... For my application it only has to be unique if, it was used <6 months ago. Thinking to compare it to created_at, but d...
I saw this code in a Rails controller: respond_to do |format| format.js {} I've seen this for XML and HTML formats but not for Javascript. Is this the way you specify a return format if you use for REST, like if you use replace_html or remote_form_for? I know RJS templates return compiled Javascript so I'm thinking maybe this is w...
Do these two forms of 'render' have the same effect? render 'contribute' render :action => 'contribute' ...
I've noticed that pagination gems like mislav-will_paginate are quite popular. Is this because Rails does not have a built-in pagination solution or because the built-in solution is not very good? ...
I'm looking for a reliable way to convert a HAML template to an equivalent ERB/HTML template? Has anyone come across one? ...
I am converting some of my link_to_remote generators with link_to as the AJAX calls were creating issues with my browser back button. (Silly noob mistakes!) My application has many pages that have a long wait cycle (for various reasons out of my control). I have been relying on the link_to_remote's ability to use :before and :after call...
I'm in the process of developing written code standards for a Rails app and am looking for some good examples of coding standards developed by others. Something that expands a bit on the ideas discussed in... Does anyone have a good reference to share? http://www.scribd.com/doc/2889649/Rails-coding-standards-defined Examples: ...
I have a directory called 'xmonroe' in the vendor/plugins folder of my Rails app. It doesn't have a gemspec, only various rake files. Would it be possible to install this as a gem or does this require a lot of tinkering? The reason I am considering this is because when I run the xmonroe_install script as described in the readme for th...
I am using the paperclip gem to attach files to models. When you upload a file using Paperclip, the file is saved ONLY when the model is saved. Thus, if the model is invalid, the uploaded file is not saved. Is there a way to temporarily save the uploaded file, so that the user doesn't have to upload the same file if the model is invalid?...
Here's the deal. I've got articles and issues, both of which can have a release date. (Issues must, articles can.) Whichever date is earlier is the release date. I've got all the logic for that basically worked out, and it all works perfectly, except I can't quite figure out the order clause to order by this release date. What is the cl...
Hi All, I'm having a slight issue with one of my Rails models. It's nothing I can't work around (as I've already done so), but I'm interested in the actual issue. Basically, I have an ActiveRecord-based class named "Events" that I've connected to a remote database using "establish_connection". It all works fine and I can even perform...