RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Jari is right. It is easy to fix. Use

 config.generators do |g|
   ...
     g.fallbacks[ :shoulda ] = :test_unit
   end

instead

Great work as usual!

Avatar

Kind of related to the topic of generators, I've been working on a gem for quick project creation from templates (not just Rails, any kind of project) You can check it out (pun fully intended) on github:
http://github.com/i0n/jumpstart

Avatar

Thanks a lot for this great screencast !
I experienced some difficulties to adapt it for has_many through relations, but finaly found a nice way without changing to much things.

Source code here : http://pastie.org/987614

Avatar

The ruby-debug Basics [screencast] link is broken

Avatar

Hey Ryan nice video, I learned some more tips about that now.

About replace scaffolds I think the problem is only the path.
I use here for haml -> /lib/generators/haml/scaffold/templates/index.html.haml and other.
I think you need do the same for erb: /lib/generators/erb/scaffold/templates/index.html.erb

You used lib/templates instead of lib/generators

Avatar

Thanks again!

Here are some nice resources/blog posts of almost everything with Rails 3 generators

http://www.viget.com/extend/

Avatar

The customized scaffold template is not used because you require 'rails/generators' at the end of the application.rb file.

Avatar

Before a few days i manage to overwrite the migration template adding collation and encoding info.

I have create a new file here:
"lib/templates/active_record/model/migration.rb" so you may have to adjust the the folder name for the scaffolding to work.

I have found the right folder name for the controller/view scaffolding, but at my village PC so i don't have the right folder name here, sorry ;-). One problem that i have found is that the lis of files that the generator makes is hardcoded. So not an easy way to have an _item.html.erb partial other than to copy and rename the generator inside lib/generators.

Keep your good job Rayan

Avatar

Hello Ryan,

Thanks for all the episodes. They have greatly helped me in trying to migrate a legacy Oracle / Developer 6i n tier enterprise application to RoR.

I am still in the early stages of the migration, having completed authentication and main menu.

My idea is to migrate the application with minimal or no change to the database structure (over which, of course I don't have any control).

Would be glad to share my progress if you could tell me where post ?

Regards.

Ramesh

Avatar

In this episode you will learn how to use a virtual attribute to format the time to your liking.

Avatar

whole idea that complex software should "help" me doing things

Avatar

If I'm repeating someone above, feel free to delete this, but instead of creating .gitignore files in the directories you want to add to the repo, you can just add them with:
git add -f tmp log vendor

Avatar

If you are getting a message:

uninitialized constant ApplicationController

then rename application.rb to application_controller.rb

Avatar

In edit form, when i click "Add Answer" and add new answer to an existing question, the new answer does not get saved.In order to save the newly added answer,I must make some modifications in the questions content. However, If i add a new question and add answers to it, that question and all the corresponding answers get saved.

I could not figure out what went wrong? What prevents adding of new answers in the existing question?I am using Rails 3.0.0.beta3

Avatar

So its almost June 2010,.. can prawn/prawnto now finally support merging PDFs together as requested by @powerplant on March 16, 2009? And be in a release of prawn/prawnto which supports prawn-format?

Avatar

I get an error:

TypeError (can't convert HashWithIndifferentAccess into String)

from serialize :params, which is generated from

def create
  PaymentNotification.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id])
  render :nothing => true
end

Any ideas?

Avatar

Thanks for this episode Ryan, awesome work as usual !
I really like the idea behind MetaWhere except the fact that it extends Symbol so I've created a small wrapper around Arel::Attribute (http://github.com/samleb/sexy_scopes).
I hope you guys will find it useful.

Avatar

I like the new action mailer. However, I am having trouble linking to things inside the email. I specified the host option as stated in the episode, but no luck.

Ideas anyone? Im using rails 3 beta3.

Avatar

very nice, thanks for such a great post :)

Avatar

Is there a place where i could find and download the full source code for this tutorial?
Thx!

Avatar

Question concerning delete:
How may I perform an "ajax" delete in a list of products.
if attribute: data-method is specified rails.js handleMethod is called, which adds csrf params into a hidden form and form.submit is called. form.submit is nt performed as an ajax request.
Using data-remote instead of data-method would nt add csrf params.

What s the best approach to achieve that?

Avatar

that was most excellent.

Avatar

But but but... how? it's magic... it's just. wow. I love rails.

Avatar

After 24 hours I found the cause of the problem. And since Ryan likes us to give something back :), here:

My ruby is in usr/local - am not using the mac one. when I did "passenger-install-appache2-module" my LoadModule instruction came up with "PassengerRuby /usr/local/bin/ruby"
Only when I changed that to the mac installation of ruby did everything fall into place.

LoadModule passenger_module /Users/XXXXXX/.gem/ruby/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
   PassengerRoot /Users/XXXXXX/.gem/ruby/1.8/gems/passenger-2.2.11
   #PassengerRuby /usr/local/bin/ruby
   PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

cheers, Daniela

Avatar

The delayed_job plugin is amazing, I use it in several apps. The biggest problem with it is the lack of monitoring of the daemonized process and the jobs themselves.

To address these issues I wrote the delayed_job_tracer plugin, which will monitor your delayed job process and send you an e-mail if delayed_job crashes or if one of its jobs fail.

Here's an article that describes how it works:

http://modernagility.com/articles/5-monitoring-delayed_job-and-its-jobs

Avatar

How do you get it to work, if you map.root? As soon as I get rid of index.html in public and have a welcome controller & index file instead, I can't get it to work. With mongrel, it works. I'd like it to work with phusion passenger. (am in development at the moment) Any suggestion?

Avatar

Nice cast. But one thing that struck me. How do you translate the those validation messages when you use the self made partial as shown in this cast?

Avatar

Hi Ryan, thanks for this screencast. One Question: Did someone get it work under rails 3 already? And how? ;-)

Avatar

thank yo0u very much backlink için dostum :)

Avatar

thank yo0u very much backlink için dostum :)

Avatar

There is a nice demo rails event crud app integrating the jQuery full calendar plugin, even with repeating events: http://github.com/vinsol/fullcalendar_rails

Avatar

I noticed that your example didn't include authorization for the UserController or UserSesssionController. If you were to implement authorization for these controllers would you use Authlogic's authorization (:require_no_user) or declarative_authorizations and why?

Thanks.

Avatar

Hi all. I have tried to get this to work for hours but no luck. Everything goes smooth until I hit the crop button and I get a No Method Error:

NoMethodError in PeopleController#update

private method `sub' called for ["-resize", "200x", "-crop", "200x200+0+33", "+repage"]:Array

RAILS_ROOT: /Users/dale/code/event_log
Application Trace | Framework Trace | Full Trace

/Users/pasley/code/event_log/lib/paperclip_processors/cropper.rb:6:in `transformation_command'

I have checked my ImageMagick install and it works. I have triple checked all of my files against the screencast, but I keep getting the above. Any idea on what is going on here?

Avatar

How could you list the leaves of a node in an acts_as_nested_set model using arel?

The select statement should be something like this

select * from tree where lft = rgt-1

Avatar

This is perfect! Thanks so much Ryan. I was just exploring the topics you covered today. Can't wait to implement what I learned tomorrow!

Avatar

TuneUp link doesn't work anymore. Are they out of business or something?

Avatar

Thanks Ryan

Rails 3 is very exciting!

I hope to see you at RailsConf 2010, I want to buy you dinner or a least a beer.

Ben

Avatar

I found it at last.
If a style is called :original, it leaves only that one.
Cheers
J.

Avatar

Ryan,

Thanks for the mention of MetaWhere today! I'm really excited about it and I hope it helps make Rails 3 conditions a lot more powerful and flexible. Continuing on your theme, I've also got a post up at http://metautonomo.us/2010/05/11/activerecord-relation-vs-arel/ that your viewers might be interested in which helps to clarify some of the differences between AR and Arel. It also has a few more nifty tricks you can pull with Arel.

Avatar

Hi guys and girls :)
I use paperclip and it is wonderful plugin/gem however when I upload the picture I want to have only the styled versions of it :style=>{...} and not to upload the original. Paperclip seems always to upload the original image as well and I don't want to have that.
Any ideas?
Cheers

Avatar

I'v stared to think that it's still Sunday when checked your site and noticed that that's no now railscast :(

Avatar

Date.parse(params[:month]) didn't work for me using Ruby 1.8.7

In controller just replace params[:month] with params[:month].gsub('-','/') so you have:

@date = params[:month] ? Date.parse(params[:month].gsub('-', '/')) : Date.today

Avatar

This is really fabulous!
I already have some of them but I am still going to save all of them.
Thanks for your wonderful sharing.