great job as usual, ryan but please, stop doing casts for rails 3.
- not many use it yet
- it's not stable (things break here and there) and we dont want to waste development time on something that's 3/4 baked.
- please continue to support rails 2.3.5+
While I see this is different, and possibly better, I am worried about two things.
First, I don't see why this change must occur. It seems that all it is doing is building a SQL query in the background and delaying its execution. Why can't Foo.all delay in exactly the same way, without syntax change?
Second, I used hashes a lot, such as conditions = [ "age < :age", { :age => age }] -- is that syntax actually gone?
I just don't see this as a step forward, but just an incompatible change.
Is it possible to have an index with just the search form and when a user "submits" then the results are printed below? Currently I have an unfiltered list that becomes smaller upon "Submit". Also I can create dropdowns using searchlogic, but they don't render results (filter my list) when I hit submit.
I am a newbie, so bear with me.
My newly create site using searchlogic is here: http://grants.firelightfoundation.org
I'm really excited about implementing search with this Railscast, but I keep getting an error I can't find help on. When I render the search form, I keep getting:
undefined method `nil_class_path' for #<ActionView::Base:0x3775a94>
I was pretty much unexcited about Rails 3, for the things I've seen so far, but this is really clear and cool!
Consider casting your scraps about controller ?
Thanks for the great screencast Ryan! I'm really looking forward to Rails 3, and the lazy loading features you mentioned should really help performance in database intensive/high-traffic applications. Looks like some REALLY sweet stuff!
Anyone had a issue using jqtouch whereby your mobile views (as created above) continuously reload in an infinite loop? I tracked it down to the setting of location.hash in jqtouch.js on line 189 (beta 2), but I'm not sure of the underlying reason.
Never mind ... another N00B mistake ...
MY APOLOGIES TO ALL ..
there was a sneaky image output tag that was hiding ... and i didnt see it until after a good night sleep and a strong coffee in the morning ...
OK, Just fixed 50% of my own problem ....
(n00b = me) forgot to include jquery library
I get the crop options, however, It is not saving the cropped version :( and its still outputting 2 of the :large items ...
Hinestly, this seems like it presents a lot more complexity and overhead than just using config.gem and normal sudo gem installs. Is it required by Rails 3?
I would love to see your ideas in form of a plugin, ryan. :)
Data Mapper of Merb does provide such a syntax, you can do queries like :age.gt(18) or :name.like("%rails%"). I believe, "or" conditions where possible aswell, but I don't recall the syntax...
@Greg, no, in the long run it should decrease the number of SQL queries. Since it waits until the last moment before the query happens, there are times the query may not be necessary.
@BrettD, I don't think there is any additional support for OR queries here. You'll still need to use an SQL string in the where clause, but I wouldn't be surprised if a plugin comes out which does add OR capabilities. I have some ideas on how it could be done.
As for your second question, I have no idea why that is failing without seeing the full error message. Feel free to email me: ryan at railscasts dot com.
Interesting changes, very clean. I like this a lot more that that bundler business, that's for sure. Unfortunately, even though we're all being encouraged to switch to Rails 3 asap, there are a lot of plugins and gems that are still incompatible. So its going to be a while for me, anyway.
Very Good!
I am work in Windows + Rails 2.3.4,have some problems.
a. proc {|a| ..} replace lambda {|a|..}
b. <%= f.check_box :_delete %> replace <%= f.check_box :_destroy %>
I have just tried this tutorial, great walkthrough by the way.
I end up with the :large image outputting twice and no crop options overlaid .... the submit button works but .... doesnt seem to let me crop :(
anyone want to help me tackle this?
Update: I found my problem. There was a http-user-agent check in my application controller, which caused the IPN to bounce.
Again: thanks for your amazing screencasts.
Symbol to_proc. If you want to combine two methods like you're trying to do, I recommend creating a new "full_name" method in the actor model to do this.
@0x4a6f4672, I think the train wreck analogy mostly applies when you are jumping through many different types of objects and through methods which can return different data. For example:
Article.first.comments.first.user.name
That line is fairly fragile because "first" may return nil. Also if there is a problem it can be more difficult to debug.
These find method calls are very consistent and always return a relation or scope object which behaves the same. I don't see a problem with it.
In the "Advanced Rails Recipes" book from Mike Clark, recipe 31 illustrates how to prevent train wrecks. According to Clark, train wrecks are long method chains to access attributes. Somehow the new syntax with queries like User.where(:name => "nonsense").order('id').limit(10) looks like a train wreck.
Thanks Ryan! Love your screencasts. I followed all your PayPal tutorials and everything works as expected. But when I test my code live, the IPN doesn't seem to get through . I keep getting error messages in the PayPal IPN-log:
IPN delivery failed. HTTP error code 500: Internal Server Error
Anybody getting "warning: already initialized …" messages while running some commands will want to take a look at http://github.com/carlhuda/bundler/issues/issue/51/ - but basically the fix is just to do "rvm implode" and reinstall RVM from GitHub.
great job as usual, ryan but please, stop doing casts for rails 3.
- not many use it yet
- it's not stable (things break here and there) and we dont want to waste development time on something that's 3/4 baked.
- please continue to support rails 2.3.5+
thank you, ryan! :)
Ryan:
Thanks for yet another wonderful episode!
With respect to your "nifty-generators" gem, will it available in 3.0?
Thanks,
Alex
While I see this is different, and possibly better, I am worried about two things.
First, I don't see why this change must occur. It seems that all it is doing is building a SQL query in the background and delaying its execution. Why can't Foo.all delay in exactly the same way, without syntax change?
Second, I used hashes a lot, such as conditions = [ "age < :age", { :age => age }] -- is that syntax actually gone?
I just don't see this as a step forward, but just an incompatible change.
Is it possible to have an index with just the search form and when a user "submits" then the results are printed below? Currently I have an unfiltered list that becomes smaller upon "Submit". Also I can create dropdowns using searchlogic, but they don't render results (filter my list) when I hit submit.
I am a newbie, so bear with me.
My newly create site using searchlogic is here: http://grants.firelightfoundation.org
where("hidden != ?", true)
shouldn't that be
where("not hidden") ?
Thanks!
I'm really excited about implementing search with this Railscast, but I keep getting an error I can't find help on. When I render the search form, I keep getting:
undefined method `nil_class_path' for #<ActionView::Base:0x3775a94>
Any ideas?
Isn't this exactly like Sequel? Anybody know the of any differences (besides filter => where and those stuff).
Allways like sequel anyways.
More importantly. Is AR now threadsafe (sequal is)
Ryan,
Loving the tour of Rails 3 so far. This is amazing content :)
-John
Ryan,
Thanks for another fantastic episode, keep it up - you're a one man training company !
thanks
Ryan, thank you very much for (again) a splendid video.
If you would charge for accessing this site I would gladly pay you.
Thanks!
I was pretty much unexcited about Rails 3, for the things I've seen so far, but this is really clear and cool!
Consider casting your scraps about controller ?
Thanks ! love your Work.
Thanks for the great screencast Ryan! I'm really looking forward to Rails 3, and the lazy loading features you mentioned should really help performance in database intensive/high-traffic applications. Looks like some REALLY sweet stuff!
Anyone had a issue using jqtouch whereby your mobile views (as created above) continuously reload in an infinite loop? I tracked it down to the setting of location.hash in jqtouch.js on line 189 (beta 2), but I'm not sure of the underlying reason.
Never mind ... another N00B mistake ...
MY APOLOGIES TO ALL ..
there was a sneaky image output tag that was hiding ... and i didnt see it until after a good night sleep and a strong coffee in the morning ...
KEEP UP THE AWESOME RAILSCASTS ...
OK, Just fixed 50% of my own problem ....
(n00b = me) forgot to include jquery library
I get the crop options, however, It is not saving the cropped version :( and its still outputting 2 of the :large items ...
Hinestly, this seems like it presents a lot more complexity and overhead than just using config.gem and normal sudo gem installs. Is it required by Rails 3?
Hi!
I would love to see your ideas in form of a plugin, ryan. :)
Data Mapper of Merb does provide such a syntax, you can do queries like :age.gt(18) or :name.like("%rails%"). I believe, "or" conditions where possible aswell, but I don't recall the syntax...
iGEL
@Greg, no, in the long run it should decrease the number of SQL queries. Since it waits until the last moment before the query happens, there are times the query may not be necessary.
@BrettD, I don't think there is any additional support for OR queries here. You'll still need to use an SQL string in the where clause, but I wouldn't be surprised if a plugin comes out which does add OR capabilities. I have some ideas on how it could be done.
As for your second question, I have no idea why that is failing without seeing the full error message. Feel free to email me: ryan at railscasts dot com.
Interesting changes, very clean. I like this a lot more that that bundler business, that's for sure. Unfortunately, even though we're all being encouraged to switch to Rails 3 asap, there are a lot of plugins and gems that are still incompatible. So its going to be a while for me, anyway.
@Fredrik. Thanks for that info. :) I was just about to install virtual OS when I saw your comment.
Thanks Ryan for your great screencast. Looking forward to more Rails 3 screencasts! :)
Have a nice day.
Very Good!
I am work in Windows + Rails 2.3.4,have some problems.
a. proc {|a| ..} replace lambda {|a|..}
b. <%= f.check_box :_delete %> replace <%= f.check_box :_destroy %>
I have just tried this tutorial, great walkthrough by the way.
I end up with the :large image outputting twice and no crop options overlaid .... the submit button works but .... doesnt seem to let me crop :(
anyone want to help me tackle this?
Great timing with this Railscast!!
2 Q's
1. Would there be an easy way to chain where with OR instead/with AND
2. any ideas why this is happening?
e.g. THIS FAILS
models/post.rb
scope :visible, where("is_public =?", true)
controllers/posts_controller.rb
@posts = Post.where("user_id=?",current_user)
@posts = Post.visible if params[:view_all_posts]
this fails complaining about nil array..
But..THIS WORKS
controllers/posts_controller.rb
@posts = Post.where("user_id=?",current_user)
@posts = Post.where("is_public =?", true) if params[:view_all_posts]
this works...
Ty all,
Update: I found my problem. There was a http-user-agent check in my application controller, which caused the IPN to bounce.
Again: thanks for your amazing screencasts.
Keep up the excellent work you are doing.
Thanks again for another quality screencast. Question: can bundler be used to generate the gemspec for a gem you're releasing?
Does this increase the number of SQL queries?
I'm sold on the new active record queries after watching this screencast. Thanks again for another great, easy-to-digest, screencast.
Symbol to_proc. If you want to combine two methods like you're trying to do, I recommend creating a new "full_name" method in the actor model to do this.
@0x4a6f4672, I think the train wreck analogy mostly applies when you are jumping through many different types of objects and through methods which can return different data. For example:
Article.first.comments.first.user.name
That line is fairly fragile because "first" may return nil. Also if there is a problem it can be more difficult to debug.
These find method calls are very consistent and always return a relation or scope object which behaves the same. I don't see a problem with it.
@EppO: I believe you can leave out the square brackets:
cars = Car.where("color = ? OR color = ?", "black", "red")
Wow, Arel certainly cleans things up a lot especially with scopes. Awesome!
@someone: you can do a "OR query" like this:
cars = Car.where(["color = ? OR color = ?", "black", "red"])
great screencast, thanks Ryan
In the "Advanced Rails Recipes" book from Mike Clark, recipe 31 illustrates how to prevent train wrecks. According to Clark, train wrecks are long method chains to access attributes. Somehow the new syntax with queries like User.where(:name => "nonsense").order('id').limit(10) looks like a train wreck.
with this new way of doing things, how would you go doing an "or" condition?
Nice introduction.. Thanks for covering the Rails3 changes; it is a lot more enjoyable for me than just reading the blogs. :)
I was waiting for this one to come with the new Rails 3 casts you are pumping out. Arel rocks :)
Thanks Ryan.
Thanks Ryan! Love your screencasts. I followed all your PayPal tutorials and everything works as expected. But when I test my code live, the IPN doesn't seem to get through . I keep getting error messages in the PayPal IPN-log:
IPN delivery failed. HTTP error code 500: Internal Server Error
Any ideas?
Just can't wait for the day when rails3 is released and all gems and plugins are working with rails3.
And of course I'm waiting for the next Railscast ^^
Anybody getting "warning: already initialized …" messages while running some commands will want to take a look at http://github.com/carlhuda/bundler/issues/issue/51/ - but basically the fix is just to do "rvm implode" and reinstall RVM from GitHub.
Is there support for has_many :through situations?
Awesome! Very handy!
thanks JPB, script/generate cucumber didn't work for me, your comment just made the trick: you need cucumber-rails gem now
It's now just "gem install metric_fu" rather than jscruggs-metric_fu since the advent of gemcutter.
I got caught out by this, and spent ages trying to get reek working…
(A shame the comments aren't mirrored on the ASCIIcasts, since anybody working from those — like I was — won't see this :)
Post is already obsolete, and no one is interested, but only in vain spam
Super post!
Initial setup problem was only a single quote issue:
Given a user exists with first_name: 'Jason'
this wouldn't work for me and I pulled my hair out just to find out that all I needed was double quotes:
Given a user exists with first_name: "Jason"
I submitted a lighthouse ticket:
http://is.gd/8QcDx