RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

I'd really like to see a screencast on backgroundrb/druby combined with rails.

Avatar

I believe script/plugin in this case is just wrapping svn co since this is exactly how svn works as well.

Avatar

Generate the normal html-form to destroy

Avatar

It would be even simpler if link_to did not force the javascript handler to use the url in href (why do that? let the onclick handler and href be independent

Avatar

Looking at the source it appears it's possible to set the element_name or collection_name like this in the class

Avatar

Which one should I use? Is gemcutter the most recent?

Thanks

Avatar

It is no mystery for those of us who have been in the design business for a while that a logo should be as simple as it can possibly be–well, many other things should too, but we’ll take it one step at a time.

Avatar

I'm creating a new agent object for each new request, and I need to re-create the cookie with the previous session ID.

Avatar

Thanks for this episode! simple_form seems very useful.

Just curious how it plays with other gems such as jquery-autocomplete and dragonfly?

Cheers

Avatar

Does anyone know if {resource_name} is always available in rails?

Avatar

Hi Ryan!

Thanks for the great casts. I just wonder, When I use standard checkout, why balance in my paypal sandbox doesnot reduced even my transaction is success?

Thanks, I hope you will glad to reply :)

Avatar

I found a way around the problem I described in 107 which I describe here

http://www.ruby-forum.com/topic/218049#945995

Avatar

I have been following and using railscasts for the last 6 months now and without them I would lost. Thank you so much Ryan for all the time and effort you put into your excellent casts

I'm having a few problems following along with this cast though and in particular with the installation of wkhtmltopdf. I was wondering if anyone else has experienced similar problems or has any clues as to what is going wrong. It is a rails 3 app, 1.9.2 running on snow leopard. I use rvm

I added PDFkit to my gemfile and the appropriate config options to my application.rb. I then tried to see if a could get a pdf version of one of the pages in my app and I got the following action controller exception

No wkhtmltopdf executable found at /usr/local/bin/wkhtmltopdf
>> Install wkhtmltopdf by hand or try running `pdfkit --install-wkhtmltopdf`

I tried installing using the command

pdfkit --install-wkhtmltopdf

this didn't go smoothly and I had to add the directory and change some permissions but I got it installed. I'm still getting a permission denied exception but as far as I can tell the file is rwx for all

It kind of feels like I have drifted down the wrong path completely with this. If anyone has any pointers they would be greatly appreciated

Avatar

For those who use this example under Rails 3 and get 'Uncaught SyntaxError: Unexpected token &' (at least on chrome) - you have to remove h method in helper:

link_to_function(name, h("add_fields... -> link_to_function(name, ("add_fields

RoR3 escapes by default ;)

Avatar

Is there any additional tutorial to add new component?

Thanks.

Avatar

so, which features in formtastic are not in simple_form? would i miss them?

Avatar

Following up : there doesn't appear to be a point when a DB table for the sessions is created anywhere in the screencast. Where does that happen?

Avatar

problems with logging in...

screencast got me to where I can create users without a problem. But I can't get it to create a session. I am using a form that sends data to the server via an Ajax request (this may change, but for now I have to do it this way).

Looks like :
<% form_remote_tag :url => {:controller => "user_sessions", :method => 'post'} do -%>

<%= text_field_tag "user_session[email]", "email you registered with", :class => "messageTextField"%>

<%= password_field_tag "user_session[password]", "", :class => "messageTextField"%>

<% end %>

I can see the data coming in as :

Processing UserSessionsController#create (for 12.13.14.15 at 2010-10-04 22:42:17) [POST]
  Parameters: {"commit"=>"DONE", "user_session"=>{"password"=>"campaign", "login"=>"myemail@gmail.com"}, "method"=>"post"}

And confirm that the user exists and the credentials are right. The code processing it is :

 def create
    @user_session = UserSession.new(params[:user_session])
    msg = (@user_session.save) ? "success" : "failure"
    if request.xhr?
      render :update do |page|
        page.alert(msg)
      end
      return
    end
  end

and it's not working...

Avatar

Great!
Congrats to @plataformatec and @josevalim.

Avatar

I have tried to get your tutorial to work with JQuery BBQ but after 3 hours not getting past the first step I give up...

http://benalman.com/projects/jquery-bbq-plugin/

If you find time, an update for Rails3/Current JQuery+JQuery BBQ would be superb. I love your casts.

Avatar

Im really surprised at how jose valim keeps up with making so many useful gems.

Thanks ryan

Avatar

Nice stuff, Ryan. One of the things I love about your previous podcasts was the keystrokes in the top right hand corner of the screencast when you were in textmate.

I don't see them in this screencast. It's one of those hidden gems in your screencasts... increasing my knowledge of textmate shortcuts.

Specifically, around 2:04 when you did a keyboard shortcut to copy the line directly above. **This could be editing magic, but I doubt it.

Hope to see these in the future, but no big deal if you don't. Whatever makes these things easiest to produce, go for it.

Thanks again for all of your work.

Avatar

I discovered simple_form some weeks ago and I'm loving it. Yes formtastic is great but I love the much, much simpler html/css generated by simple_form and in 99% of cases I've no use for the more advanced formtastic features.

Avatar

i like simple_form and it's markup..i had found a simple_form tmbunde::
http://github.com/doabit/simple_form_tmbundle

Avatar

Very Nice screencast. Thanks!

Ryan, Where is the FLATTR button on this site man?

you should definitely put a flattr button, so people can donate easier.

This a good explanation flattr:
The Best Thing Since Sliced Cake: Flattr http://bit.ly/bntaqf

I have invites if you want.

Avatar

Thanks Ryan! This type of functionality is absolutely something that everyone can benefit from. I'd go as far as to claim it should even be in the Rails core.

Nice, concise screencast. Keep'em coming!

Avatar

awesome rails cast, of course. I owe you money Ryan!

one thing that I found though in order for the javascript to actually exocute, using Rails 2.3.5 and jQuery 1.4.2 is that you need to add render layout=> false option to the format.js in the controller, like such:

    respond_to do |format|
      format.js { render :layout => false }
    end

Avatar

Ryan, thanks for this screen cast!

Its possible to make multistep form with file_field element?
When i try, i have error:
can't dump File
because rails are trying to write in session!?

Any idea?

Avatar

@Joshua

In your functional tests you can set your host like this:

@request.host = 'subdomain.example.com'

Avatar

Hi, while I'm trying to do almost the same with add/remove javascript link I had following error:

undefined method `klass' for nil:NilClass

But I don't really understand why, can someone help me please ?

Thanks in advance.

Avatar

I wondered if there is a way to tell inherited_resources to respond_to :xml by default. I configured my controller with "respond_to :xml, :atom", but when i'm asking for my resource like domain.com/xmlapi/resource, it tries to respond to html - a bug?

Avatar

This is a great post!

I tried the first part of this (excluding the JS part) and followed the instructions to the 'T'. I added the new MIME type and created a index.mobile.erb view. When I tried to load up that page on a mobile device, I got an error saying "TypeError: Can't convert symbol to a string" and it points to the use of 'format' in the helper method 'prepare_for_mobile'.

Ryan, I'm wondering if you know why this is happening?

Avatar

Does anyone know why I would be getting an error that says, I can't leave the selection field blank. here's the code I put in the items\_form.html.erb:
   <p>
      <%= f.label :Category %><br />
      <%= f.collection_select :categorry_id, Categorry.find(:all), :id, :name, :prompt => "Select A Category" %>
      or create one:
      <%= f.text_field :new_categorry_name %>
and the code i placed in the model.
attr_accessor :new_categorry_name
  before_save :create_categorry_from_name

  def create_categorry_from_name
    CreateCategorries(:name => new_categorry_name) unless new_categorry_name.blank?
  end

however when I try to create an entity it wont allow it. it's says I cant leave it blank. Any suggestions?

Avatar

Hi Ryan,

Thanks for the introduction to validation reflections!

Do you plan on showing how to implement custom FormBuilders?

Avatar

Thanks a lot for this screencast, Ryan. Engage is great and can be set up in minutes!

Ka, as I've seen you can keep the underlying Devise users sign up / sign in intact, and offer both kinds of authentication.

We've also to remind that if the users are allowed to sign in with, say, Gmail, and then try to edit their Devise accounts, this can lead to errors if they try to change their email. Anyway as Engage will give you the basic stuff in minutes, you can spend some time later putting everything else in order around it.

Avatar

Got it! Apparently this ist a feature of the paid service called "mapping".

Avatar

Check the Android simulator to check the looks, especially since Android is growing rapidly on the web!

Avatar

Great solution But ....
There is a # in the url which is ok if you are linking to content on the same page but totally naff if you are linking to other pages.

It seems however that there is no way of doing this without using a # in the url which leaves the problem still to be solved IMO.

Yes, great for pagination but when you have pages that you want to link to it's just wrong.

If anyone has any idea on how to do this without the # in the url I'd love to hear it.

Why?
I want to load the specific content for each page when a link is chosen without doing a refresh of the static content in the headers, side bars and footers. Yes caching takes the pain away but I'd rather have the AJAX solution for the effects of a web 2 style site.

Avatar

How difficult is it to integrate RPX with local logins?

Avatar

And i really hate the iPad spellchecker! :)

Avatar

Sounds great but what about existing users? I tralla Gould like to integrere this on One of my sites but then existing users Must have some way to link their accounts to, say their facebook login.

Avatar

Does this hold good for rails 3?

Avatar

If anyone has a link to a guide on switching from Authlogic to Devise I'd be very interested in that! Thanks.

Avatar

@artyomst thanks for pointing out Rails 3 correction

Avatar

Hi,

I have a sample app that demonstrates using rpx_now gem to add Janrain Engage without the need to use authlogic or devise.

Check it here: http://github.com/hatem/janrain-engage-demo

Avatar

Hi,

I have a sample app that demonstrates using rpx_now gem to add Janrain Engage without the need to use authlogic or devise.

Check it here: http://github.com/hatem/janrain-engage-demo

Avatar

has_many :taxonomic_links, :foreign_key => 'name_id'

belongs_to :taxon_name

@taxon_names = TaxonName.find(:all, :conditions=>{:genus_name => params[:gm], :corrig => params[:ck1], :type_species => params[:ck2], :sp_epithet => params[:sp]}, :joines => :taxonomic_links)

% taxon_name.taxonomic_links.each do |tax_link| %>
<%= tax_link.text %><% end %>

Its not connecting... where is the problem??

Avatar

When using :conditions => ["name LIKE ?", "%#{params[:query]}%"], it seems like character '%' in params[:query] won't be escaped to '\%'. Is there any way to fix this without replacing the param?