Rails Dispatch

Rails news delivered fresh

Presented by Engine Yard

Recently asked questions

Vote on questions you’d like to see answered by the expert contributors

Signup to ask questions or vote for the questions you’d like to see answered.

Would recommend using a rails 3.0.0.beta4 application in production?

Asked July 06, 2010

I sure liked the article “Customizing Rails Apps with Plugins”.
You mention a screencast several times, but I can’t see any link to it or any screencast embedded in the article?

I’m really looking forward to more in-depth looks at how to write awesome Rails 3 plugins and how to use the internals in general :)
Thanks!

Kristian

Asked July 12, 2010

Hi Jose,

I’m reading about hooks in Rails 3 generators. It’s great stuff, but I have one small suggestion. You said in your article “Each invoke command above is a hook and the value showed just after is the default. So the :orm hook, uses :active_record”. But line says only invoke :active_record. We have to google around to find out hook names. I think it would be nice to say something like “invoke orm: active_record” or something like that, so we can see on that spot what hook name is.

Tnx a lot and keep up with great job and tutorials,

Milan

Asked July 14, 2010

I’ve been following along with your video for creating a blog in Rails 3 (http://vimeo.com/10732081). I’m getting different output than you do in the screencast. My html forms are vanilla but in the video you have nice styles for error messages, etc. Also, following the steps in the video exactly, the error messages and the notices never show up. It’s like there are some things missing when running “rails g resource” that are present in the screencast but not on my machine. Am I missing something or has Rails 3 changed the way this works since the screencast was recorded?

Asked July 22, 2010

Its already been a month that the latest article Part 1 released.
Any time schedule when the Part 2 will be available?

Asked July 31, 2010

Test Driven Development for Rails 3 plugin development.

How would I go about this? It seems that currently, each plugin author has his own style etc. What is the recommended approach?

One “simple” but cumbersome solution is to symlink a gem into plugin/vendors of a minimalistic Rails 3 app and go from there.
But how can I test the plugin without having a full fledged Rails app as baggage?

I am trying something along these lines…

require ‘rspec’
require ‘my_rails_plugin’
require ‘active_support’
require ‘active_record’
require ‘action_controller’
require ‘action_view’

module MyAddition
def zzz
puts “Hello from MyAddition”
end
end

describe “MyRailsPlugin” do
it “should extend ActionView on load” do

ActiveSupport.on_load(:action_view) do include MyAddition end ActionView::Base.methods.grep(/xxx/).should_not be_empty end

end

Not even sure which exact class (is it Base?) that I am extending in this case, and how do I ensure that ActiveSupport loads my extension into ActionView?

I hope there is soon a part 2 to the series which goes into this.
Thanks!

I am trying to build a small Rails 3 plugin toolbox to simplify plugin development.

Kristian

Asked August 21, 2010

Some of the text in your latest article is all messed up, its under the heading “Rails 3 Plugin Structure: It’s Just a Gem” :

Make a lib directory, and put a file inside called .rb. Make a @ directory and put a @version.rb inside. In that file, create a module called @ and put a @VERSION constant inside.

Unless you really do want to create a folder named “@” ?

Asked August 26, 2010

Hi,

Last month, you’ve started a 2 parts serie about extending Rails. I’m really (positively) eager to read your 2nd part, especially about plugins as gem architecture.

Thanks.

Asked September 13, 2010

hi,

I want to use dirty object with nested attributes here is my example.

i have form having user and addresses field when i am editing user and
after updating user inside user model i am checking for any field from
user get dirty using @self.changed? method it giving me proper output in
this i am doing @self.address.changed?( I Have polymorphic association
in user and addresses) but it is giving me nil/false if address is
changed but if i am putting @self.changed? in address model it is
giving me proper output.

Please anybody explain me how to use dirty object concept with model
association or with nested attributes?

class User < ActiveRecord::Base

has_many :addresses, :as =>:addressee, :dependent => :destroy accepts_nested_attributes_for :addresses, :allow_destroy => true after_update :send_account_updated_email def send_account_updated_email self.changed //giving correct changed field name self.addresses.changed //not working self.addresses.first.changed // not working end

end

class Address < ActiveRecord::Base

belongs_to :addressee, :polymorphic => true

end

how should i do that?

Asked October 04, 2010

can you explain how i can use payment gateway in rails application ?

Asked October 04, 2010