railscasts

Rails, OpenID and Authlogic

I've been following ryan baytes screencast #170 and adding ruby-openid, authlogic and authlogic-oid to an existing authlogic authentication system. However, i keep getting the following stack of errors: NameError (uninitialized constant OpenIdAuthentication::InvalidOpenId): /Library/Ruby/Gems/1.8/gems/authlogic-oid-1.0.4/lib/authlo...

Please explain this Rails method to me like I'm a little kid.

I found this in Ryan Bates' railscast site, but not sure how it works. #models/comment.rb def req=(request) self.user_ip = request.remote_ip self.user_agent = request.env['HTTP_USER_AGENT'] self.referrer = request.env['HTTP_REFERER'] end #blogs_controller.rb def create @blog = Blog.new(params[:blog]) @blog.req = request if @bl...

Problem in Rail Casts Episode 190

After listening to Rails Cast No 190 I sat down to try it So I installed nokogiri with gem install nokogiri on my Windows 7 Ultimate laptop. I use Ruby 1.9 and this is the way i Installed Nokogiri C:\Ruby>gem install nokogiri Successfully installed nokogiri-1.4.2-x86-mingw32 1 gem installed Installing ri documentation for nokogiri...

Problem with Railscast #197 - Nested Model Form Part 2

I'm trying to implement Ryan's Railscast #197 in a system with Questions, Answers, and (multiple choice) Options. http://railscasts.com/episodes/197-nested-model-form-part-2. I have successfully implemented the nesting among these forms/partials. The simpler 'check box' way to delete records works properly. The problem occurs when I tr...

Authlogic and conditional validation

Hi, is there any possibility to perform conditional validation in authlogic's model User, that uses validation inside acts_as_authentic block depending on some conditions? I'm trying to implement multistep registration form, described in Ryan Bates's railscast 217 with authlogic. ...

Code in Railscasts 111 -Advanced Search Form

In one particular Railcasts episode Ryan talks about advanced search and in that he uses some code so as to find the conditions for the search. As its working isn't explained I wanted some clarification regarding it. def products @products ||= find_products end private def find_products Product.find(:all, :conditions => conditions) ...

Ruby on Rails: Thinking-Sphinx Affecting What is Rendering [railscast help]

I'm trying to get thinking-sphinx working for my project. I'm following this railscast to get it working, but it's not working how it should. In the railscast, Ryan does @articles = Article.search params[:search] for the index method in the controller. When I do this and replace Article.all with Article.search params[:search] when I rel...

How can I write an RSpec test for link_to_add_fields helper from Railscast 197

I used the approach details in Railscast espisode #197 on how to add dynamic input fields, but I'm not sure how to write an RSpec test for it. Suggestions? def link_to_add_fields(name, f, association, path, *args) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.semantic_fields_for(association, n...

Railscasts #228 - Sortable Table Columns

I am following Ryan Bates' railscast on Sortable Table Columns and I have successfully gotten a column to sort ascending and descending. My table is more complex than in the Railscast because I have columns from different tables. # controller @cars = Car.find(:all).order(sort_column + " " + sort_direction).includes(:manufacturers) #v...

OmniAuth & Facebook: certificate verify failed

I've followed Railscast #235 to try and set up a minimal Facebook authentication. I've first set up a Twitter authentication, as done by Ryan himself. That worked flawlessly. I then moved on to adding a Facebook login. However, after authorizing the app the redirect to /auth/facebook/callback fails with: SSL_connect returned=1 errno=0...