Thanks as always for your amazing screen-casts. Is the full stack-trace not available in the testing log file? That is where I usually look for errors during testing...
I'm running into a snag. http://localhost:3000/companies.js is not rendering the html as expected and has <li> and <ul> take in it. When I look at the source with firebug, I see <pre> tags are included in the output. I'm new to this, and think there may be an easy fix or obvious oversight.
Wonder why the captcha does not prevent that spam. I just replaced my old captcha (simple_captcha rails plugin) with the recaptcha used here, in the hope that it will work better...
You are performing a wonderful service. I'm new to rails and web programming but have been building commercial applications for 30 years.
I tried to implement your anonymous scoped search in a seemingly simple search and end up getting:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.prospects
To connect to gmail, use the plugin
http://github.com/collectiveidea/action_mailer_optional_tls
It has been updated to support Ruby 1.8.6 and 1.8.7 both.
To connect to gmail, use the plugin
http://github.com/collectiveidea/action_mailer_optional_tls
It has been updated to support Ruby 1.8.6 and 1.8.7 both.
@dani have you performed a ruby script/generate pickle? This will append pickle setup to features/support/env.rb and create a new file at features/step_definitions/pickle_steps.rb
Looks like you've had a herd of trained monkeys who've managed to post nearly 50 link spam comments to your site. Must be human to get through the Captcha.
Hopefully this will help someone out. I had a problem with this not rendering my javascript and just submitting through the format.html. turns out that because I was rendering the form with a button which popped it out, the DOM didnt pick it up in the beginning so I couldnt perform the JS on it. I tried $(#div).live but that doesn't support submit, so I ended up just embedding this code in the partial:
Pickle doesn't work form me!! I even download the episode source code and when i run "cucumber features", cucumber doesn't recognice the pickle steps!! Any suggestion?
I'm pretty fed up with Factories, and specifically Factory Girl.
Yes, they can make for easier-to-read tests. But they're a lot slower than fixtures, and Factory Girl is so poorly documented that they waste huge amounts of my coding time. In some cases, it's also very inflexible, and things that would be easy to do with fixtures are very hard to do with Factory Girl.
Example: try finding the documentation for how to create a simple has_many relationship. Say, Topic has_many Posts, such that your default factory for Topic creates one with three simple posts.
I've played with ActiveResource a bit recently, and found it lacking. I did, however, write up a little bit about it here on my blog; mostly dealing with hacks (or, as some might say, work-arounds) to deal with shallow nested routes.
I completely agree with you, reading some of the docs can be a pain in the butt. The links you posted have been very useful for me and I will use them in the future. Thanks a lot for posting and I hope you keep up the good work for this site and we can see more of you. Alternative sites to process API are not an easy thing to find :)
When using model associations (@user.posts), @post.categories, etc), you can order the options by using the :collection parameter:
<% semantic_form_for(@user) do |f| %>
<% f.inputs do %>
# Posts is an association to users
<% f.posts, :collection => Post.all(:order => :name) %>
<% end %>
<% end %>
Hi, thanks for great tutorials ! I tried build complex form for habtm associtions, but I get this error: ActiveRecord::ReadOnlyRecord. Please can you help me and describe me how it works and how to fix it? Many thanks.
@stu Pickle doesn't have anything built to handle the deletion of records but it isn't hard to create your own step definition using Pickle to achieve this: http://gist.github.com/224945
Yes, sorry. I meant that that "git add ." is only needed the first time for new files and the following times (for existing files) should "git commit -a" be enough...
Thanks as always for your amazing screen-casts. Is the full stack-trace not available in the testing log file? That is where I usually look for errors during testing...
Cheers
Thanks Ryan! I'm a big fan of Railscasts.
I'm running into a snag. http://localhost:3000/companies.js is not rendering the html as expected and has <li> and <ul> take in it. When I look at the source with firebug, I see <pre> tags are included in the output. I'm new to this, and think there may be an easy fix or obvious oversight.
Any help is greatly appreciated!
At the very least Ryan please disable comments for the older screencasts. New comments on those seem to be about 99% spam.
Damn, looks like I'll have to rename my forthcoming "Ugg" Gem then! ;-)
Thanks Ryan, nice screencast. Please post more TDD/BDD videos, I can't seem to get enough of those :)
Thanks again!
Thanks for the feedback guys. I'm planning to deal with the spam problem soon. Captcha doesn't stop it because it's actual humans spamming AFAIK.
Wonder why the captcha does not prevent that spam. I just replaced my old captcha (simple_captcha rails plugin) with the recaptcha used here, in the hope that it will work better...
Ryan, you need to do something about the spam. I think you should disable all links that aren't to pastie, github, or the similar.
suggestion if comment.include?('UGG')
then move to spam
Thanks Ryan
Keep up the good work.
Ahh, to get the trace you would run the rake task with --trace, right?
I haven't tried this though..
Thanks to this comment: 23. Beate Oct 31, 2007 at 02:34
I could look into my error. The link to Josh Owens' Website is not anymore working.
Here's the simplest solution. The code in the migration *will* work, but before you set ":counter_cache => true" in the model.
That said, I'd love to see the code in this page (and in pastie) updated with the "other solution".
Thanks for your good work Ryan. Cheers.
What generated that nice list of exceptions? That one in file "untitled 1496" ?
Thanks, definitely useful stuff.
This is exactly what I was looking for :) great job
Thanks for this. We're pushing a site into production soon, and this looks like it will help us cover a part of our tests.
Thanks again!
thx for the cast!
You are performing a wonderful service. I'm new to rails and web programming but have been building commercial applications for 30 years.
I tried to implement your anonymous scoped search in a seemingly simple search and end up getting:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.prospects
Extracted source (around line #3):
1: <h1>"Search" </h1>
2:
3: <%= render :partial => @Prospect.prospects %>
It appears the search is not being performed. What am I missing? Do you put any code into the 'show' def in the search controller?
If you do not have time to assist me perhaps you can suggest a consultant I can employ to help.
Thank you...keep up the good work!
John Lewis
To connect to gmail, use the plugin
http://github.com/collectiveidea/action_mailer_optional_tls
It has been updated to support Ruby 1.8.6 and 1.8.7 both.
To connect to gmail, use the plugin
http://github.com/collectiveidea/action_mailer_optional_tls
It has been updated to support Ruby 1.8.6 and 1.8.7 both.
great stuff! so, what about dynamic select boxes?? still by hand?
Hi,
Can you help me with this error :
uninitialized constant Formtastic::SemanticFormBuilder::I18n
Extracted source (around line #6):
3: <%= error_messages_for :task %>
4:
5: <% semantic_form_for(@task) do |f| %>
6: <%=f.inputs %>
7: <%=f.buttons %>
8: <% end %>
9:
Any ideas how i get the code from the complex forms railscasts to work with formtastic ?
How would that project example look in formtastic ?
<% for task in @project.tasks %>
<% fields_for "project[task_attributes][]", task do |task_form| %>
<p>
Task: <%= task_form.text_field :name %>
</p>
<% end %>
<% end %>
Not bed, API is very interestinc for internet.
@dani have you performed a ruby script/generate pickle? This will append pickle setup to features/support/env.rb and create a new file at features/step_definitions/pickle_steps.rb
Thank you for its - much help in decision of my problems
Ryan
Looks like you've had a herd of trained monkeys who've managed to post nearly 50 link spam comments to your site. Must be human to get through the Captcha.
I noticed that I was getting the error nil.now when starting the rake jobs:work so I had to apply the patch from this link
http://github.com/kossnocorp/delayed_job/blob/master/lib/delayed/job.rb#L251
Hopefully this will help someone out. I had a problem with this not rendering my javascript and just submitting through the format.html. turns out that because I was rendering the form with a button which popped it out, the DOM didnt pick it up in the beginning so I couldnt perform the JS on it. I tried $(#div).live but that doesn't support submit, so I ended up just embedding this code in the partial:
jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
})
jQuery.fn.submitWithAjax = function() {
this.submit(function() {
$.post(this.action, $(this).serialize(), null, "script");
return false;
})
return this;
};
$(document).ready(function() {
$("#new_review").submitWithAjax();
})
Then it works fine!
Pickle doesn't work form me!! I even download the episode source code and when i run "cucumber features", cucumber doesn't recognice the pickle steps!! Any suggestion?
Is there any explanation as to why we need to use 'attr_accessible' on all attributes in the model? Seems like a lot of work...
I'm pretty fed up with Factories, and specifically Factory Girl.
Yes, they can make for easier-to-read tests. But they're a lot slower than fixtures, and Factory Girl is so poorly documented that they waste huge amounts of my coding time. In some cases, it's also very inflexible, and things that would be easy to do with fixtures are very hard to do with Factory Girl.
Example: try finding the documentation for how to create a simple has_many relationship. Say, Topic has_many Posts, such that your default factory for Topic creates one with three simple posts.
I've played with ActiveResource a bit recently, and found it lacking. I did, however, write up a little bit about it here on my blog; mostly dealing with hacks (or, as some might say, work-arounds) to deal with shallow nested routes.
Thanks Ryan for great Casts!
They truly open RoR for many people.
Is there any way to control the junk posts like above? Please do something... these guys are annoying.
By the way-Great episode and thank you for that.
could this be used to create an upload status bar?
I completely agree with you, reading some of the docs can be a pain in the butt. The links you posted have been very useful for me and I will use them in the future. Thanks a lot for posting and I hope you keep up the good work for this site and we can see more of you. Alternative sites to process API are not an easy thing to find :)
In my case it works all fine.
And pls kill this spam :-)
Eric
When using model associations (@user.posts), @post.categories, etc), you can order the options by using the :collection parameter:
<% semantic_form_for(@user) do |f| %>
<% f.inputs do %>
# Posts is an association to users
<% f.posts, :collection => Post.all(:order => :name) %>
<% end %>
<% end %>
@Austin Ginder try to use will_paginate for it. I think it's the only way for now.
Solved :D. I overwrite readonly? method in controller so:
def readonly?
false
end
Hi, thanks for great tutorials ! I tried build complex form for habtm associtions, but I get this error: ActiveRecord::ReadOnlyRecord. Please can you help me and describe me how it works and how to fix it? Many thanks.
As usual, Great cast!!
I tried to convert the table into lists as follows in the view:
<ul id="products">
<% @products.each do |product| -%>
<li><%= h(product.name) %></li>
<li><%= number_to_currency product.price %></li>
<% end -%>
</ul>
with step definition:
Then(/^I should see products table$/) do |expected_table|
html_table = element_at("#products").to_table
#html_table.map! { |r| r.map! { |c| c.gsub(/<.+?>/, '') } }
expected_table.diff!(html_table)
end
But I could not figure out the error. Whats wrong with my setp def?? plz.
Great Ryan.. Amazing..........
great tutorial. thanks a lot mate.
took me a week to make this work but still a great code
@stu Pickle doesn't have anything built to handle the deletion of records but it isn't hard to create your own step definition using Pickle to achieve this: http://gist.github.com/224945
Simple question for noob.,
A note to those using Autotest: you might want to add an exception to ignore your '.git' folder
Better Git support is built into msysGit:
Yes, sorry. I meant that that "git add ." is only needed the first time for new files and the following times (for existing files) should "git commit -a" be enough...