(not related)
I am having issues with a rails app that I am sure is fairly trivial. I generated a generic scaffold, implemented restful_auth per your instructions, and mucked around with the layout. Now I have discovered my named route new_todo_path doesn't work anymore it points to /todo/new which makes the url localhost/todo//todo/new or localhost//todo/new because I had set todo as the root controller in my routing file. Any ideas? All other routes work fine. Another strange thing is if I manually go to localhost/todo/new it creates a record without me even submitting the form.
What is the best way to auto-trigger the print button/action in Rails? So that 1). the PDF is generated and displayed on the screen via prawn/prawnto and 2). the printer selection pop-up is automatically displayed. Any help would be greatly appreciated.
Great screencast. Just what I need but I'm having problems installing rpsec and rspec-rails. When I install the gems I get: Could not find main page README.rdoc
Cucumber and Webrat installed just fine though. Any ideas? I'm on leopard.
Seconding Jeremy's aforementioned file-path "gotcha". No spaces in your project file path. That's a no-go for me and renders the entire thing totally useless.
I'm bound by multiple file organizational systems for different hosts, as well as with project management schema. I can't just put my projects into any old folder. This is an amazing flaw - I'm shocked this is never mentioned in any of the sphinx tutorials.
Hey, thanks for this Ryan. It's a really great intro to Cuke.
@Rich mentioned using Cuke with Watir. I've seen a bit about this but would love to find out a little more about this and about using Cuke with Selenium.
This is a pretty neat intro to Cuke w/ Watir: http://www.vimeo.com/2871256 but it aint no Railscast!
Hi Ryan, awesome screencast as always.
You rock man !!!
I'm trying to implement polymorphic association with 2 level nesting structure.
Basically I have projects and documents; projects have tasks as a nested resource and documents have reviews as a nested resource. Tasks and Reviews must have a polymorphic association with prompts.
The issue I'm facing right now is what I have to put on form_for in order to make it works with the 2 level nesting. I should refer to project for task and document for review but how can I do that dynamically?
I've been using Watir (Web Application Testing in Watir) for a while now. I've found that when testing javascript applicaitons, the combination of Cucumber/SafariWatir/Safari4.0 is very fluid and very fast.
Hi Ryan.
I been following you since the day i started working on ruby on rails. I am facing a problem with the rss.builder format as i am using Netbeans 6.1 on windows.So when i right click on views folder and try to generate a file with the name you specify it gives me the file with the format "rss.builder.rjs". Perhaps that could be the reason that its not working.
Can YOu please help me out.
Sry but the line $1.classify.constantize.find(value) doesn't work because in my routes there is the following line map.resources :news, :singular => :news_instance, :has_many => :comments so that I think that $1 isn't the right variable. But I don't have any better idea.
The "create" method does not change. If the checkbox is checked, then saves the "1" to the DB. In case the checkbox is not checked, I solve it with a default value of "0" in the DB.
In the case of the "update" method, what I do is iterate through the params[:task] array and check the value of the task_attribute:
params[:project][:task_attributes].each do |task|
if task[:completed] != "1"
task[:completed] = "0"
end
end
I think it is the simplest and cleanest solution I have found.
Found a way that appears to work which basically is a hybrid of the pre 2.3 way where I maintain the :index=>nil attribute and the 2.3 methodology. I also gave up on the form_builder and constructed the naming of the fields by hand circumventing the need to pass form builder objects either locally or by ajax.
Cracking Screencast this week - but here's a bit of an OT question - in this you're using the Rails bundle for textmate, yet you appear to have different shortcuts to the one I have - for instance forin and field are missing from mine - where did you get yours from?
In my opinion BDD (using cucumber) is the best way to test a rails application and present the result to a customer (which may not be familiar with programming).
I have a database which has three tables; Company, Customer and Shop. All three have various similar address fields (Address 1, Address 2 Postcode, Country etc.). I'm wondering if it would be wise to put the address parts into an Address model and use a polymorphic association to map addresses to Company, Customer or Shop. Is this a good idea?
Working for me now too. :-) Wow, Cucumber is really impressive, I've been quite intimidated by the various Rails testing methodologies but this seems quite friendly.
This looks great! One question I had, is this something that can replace shoulda? I know you said to do continue doing unit tests - so is this something I use in combination with shoulda (like your use of rspec)?
Great introduction to cucumber! I already knew the framework and noticed, that you're pointing out the power of it very clear. A great starting-point for your audience.
Please continue with these testing screencasts.
Thanks :-)
Just passing on a note of thanks for all these great screencasts. I watch them every week and have learned a ton.
Too...many...testing...frameworks!!
(hence no tests)
After last weeks episode, I was curious about Webrat and now you have answered my questions!
I've had the same issues getting mechanize and selenium to work. I still won't give up on webrat. Bryan has done a great job with this tool.
Thanks Ryan, I didn't realize it was so easy to use webrat on its own!
oh and ... "dealing directly with Webrat through ruby" ... 6:37 and 6:56 ... its looping through my brain now and won't stop.
Disregard the part about the model I think I have fixed that
(not related)
I am having issues with a rails app that I am sure is fairly trivial. I generated a generic scaffold, implemented restful_auth per your instructions, and mucked around with the layout. Now I have discovered my named route new_todo_path doesn't work anymore it points to /todo/new which makes the url localhost/todo//todo/new or localhost//todo/new because I had set todo as the root controller in my routing file. Any ideas? All other routes work fine. Another strange thing is if I manually go to localhost/todo/new it creates a record without me even submitting the form.
I'd be interested in learning how to set the email settings dynamically too.
Hi Ryan,
I was just wondering how you would go about defining a resource route using the paths case statement.
For example:
When I go to Bitstar Media's project Computer Science show page
http://pastie.org/437618
I am having alot of trouble getting this type of functionality with Cucumber. Any tips?
What is the best way to auto-trigger the print button/action in Rails? So that 1). the PDF is generated and displayed on the screen via prawn/prawnto and 2). the printer selection pop-up is automatically displayed. Any help would be greatly appreciated.
Hello, just tried running it on 2.0.2 and I get a NameError in UsersController#new
also the label_tag didn't work, but assuming that's because that method doesn't come into play until 2.1.+?
What is causing this error?
uninitialized constant User::Authentication
Great screencast. Just what I need but I'm having problems installing rpsec and rspec-rails. When I install the gems I get: Could not find main page README.rdoc
Cucumber and Webrat installed just fine though. Any ideas? I'm on leopard.
Thanks for this help.
Hi Ryan, if using cucumber, why we are still using RSPEC?
Seconding Jeremy's aforementioned file-path "gotcha". No spaces in your project file path. That's a no-go for me and renders the entire thing totally useless.
I'm bound by multiple file organizational systems for different hosts, as well as with project management schema. I can't just put my projects into any old folder. This is an amazing flaw - I'm shocked this is never mentioned in any of the sphinx tutorials.
@Phil thanks for this bit of information it was very helpful.
Awesome! I've tried cucumber and it's great!
Excellent screencast!
As I see, the main goal batches process is get the number of objects from model like will_paginate.
Is it right?
Nobody have : A copy of ApplicationController has been removed from the module tree but is still active! ???
What are wrong ?!
Thanks for help me.
I found this but it's very old : http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/1155f9ab3a65d8e7/8c128eee5b943efd?pli=1
Hey, thanks for this Ryan. It's a really great intro to Cuke.
@Rich mentioned using Cuke with Watir. I've seen a bit about this but would love to find out a little more about this and about using Cuke with Selenium.
This is a pretty neat intro to Cuke w/ Watir: http://www.vimeo.com/2871256 but it aint no Railscast!
Awesome! as always... thank you very much!
Well done!
Hi Ryan, awesome screencast as always.
You rock man !!!
I'm trying to implement polymorphic association with 2 level nesting structure.
Basically I have projects and documents; projects have tasks as a nested resource and documents have reviews as a nested resource. Tasks and Reviews must have a polymorphic association with prompts.
project/1/task/1/prompts
document/1/review/1/prompts
The issue I'm facing right now is what I have to put on form_for in order to make it works with the 2 level nesting. I should refer to project for task and document for review but how can I do that dynamically?
Any ideas is very welcome.
Thanks again for your outstanding reailscasts.
Markus:
Or Outside-In as we say in BDD land :-)
@Neil, you can find those shortcuts in my textmate bundle.
http://github.com/ryanb/ryan-on-rails.tmbundle/
I've been using Watir (Web Application Testing in Watir) for a while now. I've found that when testing javascript applicaitons, the combination of Cucumber/SafariWatir/Safari4.0 is very fluid and very fast.
Hi Ryan.
I been following you since the day i started working on ruby on rails. I am facing a problem with the rss.builder format as i am using Netbeans 6.1 on windows.So when i right click on views folder and try to generate a file with the name you specify it gives me the file with the format "rss.builder.rjs". Perhaps that could be the reason that its not working.
Can YOu please help me out.
Hi,
Sry but the line $1.classify.constantize.find(value) doesn't work because in my routes there is the following line map.resources :news, :singular => :news_instance, :has_many => :comments so that I think that $1 isn't the right variable. But I don't have any better idea.
Very interesting. Keep it up Ryan. Can you please make a screen cast on Globalize 2.
Thanks for posting it's beeen a great help
Thanks, Ryan. Terrific intro that really helped me begin to wrap my head around Cucumber.
Seems like a great way to build a rock solid Rails apps from the bottom-up.
As always, superlative work.
Hi, I wanted to share my solution for the checkboxes problem.
I simply use check_box_tag. For new:
<%= check_box_tag("project[task_attributes][][completed]", "1", false) %>
For edit:
<%= check_box_tag("project[task_attributes][][completed]", "1", task.completed == 1) %>
The "create" method does not change. If the checkbox is checked, then saves the "1" to the DB. In case the checkbox is not checked, I solve it with a default value of "0" in the DB.
In the case of the "update" method, what I do is iterate through the params[:task] array and check the value of the task_attribute:
params[:project][:task_attributes].each do |task|
if task[:completed] != "1"
task[:completed] = "0"
end
end
I think it is the simplest and cleanest solution I have found.
Regards,
Marcelo
So, this episode inspired me to extract some code and release this:
http://github.com/minaguib/resourceful_parenting/tree/master
Essentially, it replaces the hand-rolled find_commentable, as well as helper functions for doing some of the redirects discussed in the comments here.
That is so cool, Ryan! Just again when I needed an introduction to cucumber you come around with another screencast (was similar back with Liquid)!
All praise our mighty voice from beyond! ;)
Thank you for this useful and timely cast.
I'd like to see one about RSpec replacing Test::Unit.
Found a way that appears to work which basically is a hybrid of the pre 2.3 way where I maintain the :index=>nil attribute and the 2.3 methodology. I also gave up on the form_builder and constructed the naming of the fields by hand circumventing the need to pass form builder objects either locally or by ajax.
Cheers
Michael
Great tutorial! Thanks for your work.
Really good introduction to BDD. I'm gonna show your screencast to the rest of my team since I already wanted to convince them about Cucumber.
Well done again,
and thanks.
Attila
Hi Ryan,
Cracking Screencast this week - but here's a bit of an OT question - in this you're using the Rails bundle for textmate, yet you appear to have different shortcuts to the one I have - for instance forin and field are missing from mine - where did you get yours from?
Very nice screen-cast. I'm hoping to see more BDD screen-casts in the future, especially about Cucumber and RSpec.
Thanks!
Cucumber is a similar but improved way of "plain text stories"
http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails
and also integrates them.
In my opinion BDD (using cucumber) is the best way to test a rails application and present the result to a customer (which may not be familiar with programming).
Test::Unit::TestCase ... I mean ActiveSupport::TestCase for life!
Am I the only one who find these testing frameworks extremely annoying?
Thanks for the gentle introduction Ryan!
Hi,
I have a database which has three tables; Company, Customer and Shop. All three have various similar address fields (Address 1, Address 2 Postcode, Country etc.). I'm wondering if it would be wise to put the address parts into an Address model and use a polymorphic association to map addresses to Company, Customer or Shop. Is this a good idea?
Sorry about the download problems guys. Dreamhost has been a little flaky lately. May be time to find a mirror for when this happens.
@pimpmaster, good idea! I knew I forgot some other resource links. I'll add it.
@Jay, Cucumber is most often used with RSpec, but it isn't tied directly to any testing framework. You can definitely use Shoulda with it instead.
@Anlek, I plan to do more Cucumber testing episodes in the future, but not yet sure on the specific topics. Thanks for the suggestion.
Great cast!
Maybe next week you can cover Cucumber with Ajax?
Keep up the good work!
Working for me now too. :-) Wow, Cucumber is really impressive, I've been quite intimidated by the various Rails testing methodologies but this seems quite friendly.
Hey Ryan,
This looks great! One question I had, is this something that can replace shoulda? I know you said to do continue doing unit tests - so is this something I use in combination with shoulda (like your use of rspec)?
Great introduction to cucumber! I already knew the framework and noticed, that you're pointing out the power of it very clear. A great starting-point for your audience.
Cheers,
Florian