I borrowed Agile Web Development with Rails from my local library, and for Mac development it asked me to view this article:
http://hivelogic.com/articles/ruby-rails-mongrel-mysql-osx
I'm a little bit worried about following the article because I am running Snow Leopard. Does anyone have an article for installing Rails for Snow Leopard...
I'm trying to define a method inside a migration, but I'm getting an undefined method error:
undefined method 'do_something_specific' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x4868018>
I'd rather not define it elsewhere, because it doesn't really relate to the rest of the application, just this specific migration.
To b...
I'm a total Ruby/Rails/AR noob. I have a very basic sort of database schema that I can't seem to figure out the best way to represent in the Rails Way.
Table Post
String title, author
Text content
Timestamp posted
Post parent
The idea here is that top level posts will have parent that is NULL. Every response will hav...
Given the following
class User < ActiveRecord::Base
has_and_belongs_to_many :companies
end
class Company < ActiveRecord::Base
has_and_belongs_to_many :users
end
how do you define factories for companies and users including the bidirectional association? Here's my attempt
Factory.define :company do |f|
f.users{ |users| [users.a...
I've written this HAML:
%script{:src => "http://www.google.com/jsapi?key=mykey" :type => "text/javascript"}
Note the missing comma between :src and :type.
On my Production server (Dreamhost/Linux), I get the following logged exception when I try to view the page:
ActionView::TemplateError (compile error
/home/.kuce/sugarthrill_stage...
I'm revising this question after reading the resources mentioned in the original answers and working through implementing it.
I'm using the google maps api to integrate a map into my Rails site. I have a markets model with the following columns: ID, name, address, lat, lng.
On my markets/index view, I want to populate a map with a...
I have a piece of code that works fine in the console, but in a cron-driven rake task, it errors out every time, saying that the accessor function for one of the has_many relationships is not a valid method. Example:
provider has_many instances, so I'm calling provider.instances, and the rake task will throw back an error:
"undefined m...
When I add the following block of code in environments.rb, ActiveRecord::Base extends the module in the development environment but not in the test environment.
require "active_record_patch"
ActiveRecord::Base.send(:extend, ModelExtensions)
The library file which contains the module is as follows:
module ModelExtensions
def human_...
I just installed InstantRails on my PC running Vista.
When trying to update some files, I run into this error:
...\rails_apps>rake rails:update
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
where rails_apps is in the directory where I extracted InstantRails. Am I not in the correct directo...
Hello,
I've just worked through the Rail example supplied by Apple:
http://developer.apple.com/Tools/developonrailsleopard.html
Now that I'm done, I'd like to clean this up and remove the web service, database etc. Obviously I still want the RoR stack in place.
How? Can I do this using rake?
...
I am trying to locate an decent example of ajax json interaction with Rails. I have a Rails app that uses standard forms and wish to improve it with some ajax, but I have not found a good example to inform me.
...
Hi all,
A User belongs to Groups, a Group belongs to a Company
I want to verify that the username of the user is unique per company. So my database can have multiple dublicate usernames as long as they belong to a different company.
A logical step would be to use validates_uniqueness _of scope and use the company id (stored in groups)...
As I move through the iterations on my application*(s) I accumulate migrations. As of just now there are 48 such files, spanning about 24 months' activity.
I'm considering taking my current schema.rb and making that the baseline.
I'm also considering deleting (subject to source control, of course) the existing migrations and creating a...
I'm interested in building a site that has several interactive features for the users, yet want the site to be relatively light and avoid using Java or Flash. The site will start small but will hopefully be scalable. I realize developers tend to prefer a specific language and/or CMS and am wondering if you think a particular language wou...
I wonder if anyone could help with this. I am dynamically building a
form with numbered text fields like:
<input name='product_quantity_<%= product.id %>' />
This produces params like: product_quantity_1, product_quantity_4,
etc. I was thinking that I could access these parameters like
param[:product_quantity_#{product.id}] but this do...
Hi,
is there a way to get the original value that an ActiveRecord attribute (=the value that was loaded from the database)?
I want something like this in an observer
before_save object
do_something_with object.original_name
end
The task is to remove the object from a hash table (in fact, move it to another key in the table) upon u...
I want a before filter like "must_have_permission_to_write" that when called if user hasn't permission to write renders a message saying "you can't do that!" and return.
Problem is I'm getting "can only render or redirect once per action" of course...
how can I stop the execution in the before filter?
thanks
...
I have the following function in controller
def by_xy
@obj = BldPoly::find_by_xy(:x => params['x'], :y => params['y'])
respond_to do |format|
format.html { render :layout => false }
format.xml { render :layout => false }
format.json { render :layout => false }
end
and planning to w...
I've been looking on Github for a Rails project that allows anyone to sign in and add a blog entry.
Has anyone seen something like this?
...
I'm currently using Workling with Starling on a rails app. Although I like Workling, I find it kinda hard to monitor.
To make matters worse, I have a couple of Workling instances. Workling is running with the :multiple set to 'true' (inside workling_client).
I can see the pid for each instance and such, but I want to know if they're ac...