Hi All,
I would like to call
@records.collect{|r| r.set_some_virtual_attribute(@context)}
before rendering an activescaffold index view, but if I do this :
controller FooController < ApplicationController
before_filter :change_things, :only => :index
active_scaffold :foos
protected
def change_things
@records.collect...
Given this hash that comes though :params
"positions"=>{
"1"=>{"x"=>"50", "y"=>"30"},
"2"=>{"x"=>"22", "y"=>"53"},
"3"=>{"x"=>"68", "y"=>"35"}
}
How would I do this? (doesn't work, but attempting to show what I want to do)
params[:positions].each do |position|
logger.info(position.x)
end
I know, painfully beginner ...
I'm developing several apps at the moment which will require a global accounts system across all of the apps and I'm unsure of what's the best way of going about doing this.
The most obvious option is to have each app connect to 1 database but that would require duplicating the MVC login code across all the apps which would make updatin...
How do I reuse the same action mailer template for multiple mailer "actions"?
In ActionController, you can do
...
render :action => 'another_action'
I'd imagine the same thing can be done in ActionMailer, but I couldn't seem to find the right method. If it's relevant, I'm on Rails 2.3.2.
Thanks!
...
After a photo is uploaded and created using attachment_fu, is there a way to edit just the thumbnails and leave the original as it is? I understand how to do the resizing or cropping, but it's applying the edits to all of the thumbnails and the originals, which is how I'm sure attachment_fu was intended to work.
For example, say in a p...
If true it will send an error message to the user.
If false delivery errors wont be noticed.
What's the recommended way to handle this?
...
Hi,
Am trying out Ruby on Rails in Windows XP using the Hello World example. Encountered this error ? Not sure how to fix this
When I downloaded sqllite from the website, copy the dll to windows/system32.
then run "gem install sqlite3-ruby". It shows up with lots of "No definition for _wrap_sqlite3_*"
then in Firefox, http://loc...
A rails application in production should use smtp or sendmail to send mails?
...
My simple date validation regex is not working correctly...
validates_format_of :dob, :with => /\d{2}\/\d{2}\/\d{4}/, :message => "^Date must be in the following format: mm/dd/yyyy"
What am I missing here? I'm trying to validate that a date is in the following format: mm/dd/yyyy - When I enter what should be valid data, I still get th...
The "association?" query method that the Rails docs say should exist when I create a belongs_to association doesn't actually get created:
class Author < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :author
end
>> p = Post.create(:author => Author.create)
>> p.author?
NoMethodError: undefined me...
I have models Foo and Bar. Bar has column foo_id.
When I call Bar.foo_id I get the error missing attribute: foo_id
Keep in mind that this is not an undefined method error and the column definitely is in the db. What are some common causes of this?
Thanks
...
I've seen some plugins and custom rake tasks to dump the active db to fixtures, but I'm not sure what the prevailing technique is.
Basically, I want the opposite of rake:db:fixtures:load so that I can put basic db information (the admin user account, for one) into svn for when we deploy. I don't want to have to create fixtures manually ...
[see later answer for more]
I think this is just a simple rails question, and mostly on how i've named my models and reference them in my view. So a little background, I'm using the vote_fu plugin, which I think is great, however I'm having a hard time getting the voting to work from a link as follows:
<%= link_to "vote for", current_u...
So I've created an action, lets call it 'raise' in the controller 'elevator'. 'elevator' is nested in 'building'.
What routes should I create, or what link_to url can I make so
/buldings/2/elevators/4/raise will work?
Thanks,
Elliot
...
I'm using awesome_nested_set for my central website structure. I want to be able to build a UL/LI based indexbar off of the nested set but also want it to take advantage of the low database intensiveness of nested set. When I was using acts_as_tree I had a recursive function that built the indexbar. It just called itself if it encountere...
How do I set the application to production mode?
Okay, this must be a no-brainer but I'm about to deploy my first Rails app and I've got everything setup properly: Ubuntu Hardy, Passenger, MySQL. However, it's still running in development mode. I've only been able to find documentation for older versions of Rails and want to make sure t...
Is there anyway to add a find condition to all Active record models?
that is I would like this query
ExampleModel.find :all, :conditions=> ["status = ?", "active"]
to behave the same way as
ExampleModel.find :all
in every model
Thanks!!
...
Are there any future plans to replace selenium and watir with mechanize + johnson?
http://wiki.github.com/jbarnette/johnson
http://wiki.github.com/tenderlove/mechanize
...
I'm running into problems implementing statuses for a model. This is probably due to wrong design.
There is a model which has a status. There can be multiple instances of the model and only a few predefined statuses (like: created, renewed, retrieved etc.). For each individual status there is some calculation logic for the model. E.g. m...
Is there a way in which I can create a serial number (SNO) column through scaffolding in Rails which increases on adding a record, decreases on deleting a record and cannot be modified manually?
...