Hi . . i m facing a problem. when i write has_attached_file in my model .. i get an error on running the server that undefined method has_attached_file ,,, please help me solving this problem. i need it urgently... please.. i m using windows , netbeans and have installed paperclip as a gem because it is not available as a plugin,,
I can't get the message "unauthorized access" from the authorize function to be displayed. Trying to access restricted page when not logged in gets redirected to the home OK but the message isn't displayed. My home model is Type and in the 'index' view (app/views/types/index.html.erb) I have tried:
I try and login (/login) I get: session_url failed to
generate from {:controller=>"sessions", :action=>"show"} - you may
have ambiguous routes, or you may need to supply additional parameters
for this route. content_url has the following required parameters:
["sessions", :id] - are they all satisifed?
Love your screencasts.
This is my first contribution to the RoR community, so I hope it is a help.
I searched a long time for a solution, until I discovered it was right there in will_paginate.
paginate_by_parent_id nil, ...
made it possible to add an extra edge to my finds, so that the search is only for posts that do not have a parent_id.
Could not make this work with :conditions alone.
Here is the code from my model post.rb:
def self.search_list(search, page)
paginate_by_parent_id nil,
:per_page => 5, :page => page,
:conditions => ['title like ? or body like ?',"%#{search}%","%#{search}%"],
:order => 'created_at DESC'
end
A breakthrough functionality I got working for myself in a jiffy. Many thanks for your railcasts...
I am using auto_complete on a search field which auto completes a list of tag.names and company.names for Company model. And it is returning for me a collected list of matching Company or Tag names for the search string.
BUT when i select one value from the Autocomplete list, previous string in the autocomplete text-field gets vanished and the selected word takes over.
What if I need multi word values to be submitted in that search field with commas between them ?
like "Comment, Private, Nitin"
And I also got the autocomplete to work after putting a comma..
Hello, is there a way to using rails-layouts with prawn? I'll render a pdf-page with :layout => "pdf_letter" and inside this layout I using yield. But this will render a pdf file inside the pdf letter layout and is not showing.
There a an example to using prawnto like erb files and layouts in rails?
I work on a web application where I have sucessfully implemented this cool behavior.
Thanks Ryan!!!
BUT: I use this auto completion feature on a text field that queries a table with almost 4000 records ( an extensive list of restriction enzymes). The drop down menu goes way off screen at the bottom if the user only types in a single common letter.
I suppose I could limit the number of returned search results but that would possibly prevent the user from finding the correct value.
Is there a way to introduce a scroll bar to the drop down menu?
In response to Stephen's (29.) issue with error messages messing up the second select, I used Peer's solution (61.) placed in the view template, along with a line to update that first option in the select so it didn't show the first option in the list: http://gist.github.com/96784
I am new to BDD and am trying to figure out when it is that one would use rspec in this process? After the Cucumber features pass? Would rspec just get used for unit testing at that point?
@Andrew Nordman
or you could just
redirect_to [@commentable, :comments]
or through my resourceful_parenting plugin (which relieves you from even writing find_commentable):
redirect_to [parent, :comments]
or
redirect_to polymorphic_p_path(:comments)
does anyone has prawn and prawnto successfully running under rails 2.3.2? i'm getting a "Template is missing" error. Same error applies here (http://www.nabble.com/Prawn-%2B-PrawnTo-%2B-Rails-2.3.2-td22720589.html)
A friend and a business partner of mine, Wojciech Piekutowski, wrote gem that makes Prawn faster by using ImageMagick for PNG processing. You can find it on github: http://github.com/amberbit/prawn-fast-png/tree/master
I'm such a fan of named scopes now and see so many opportunities to streamline code. I ran into a problem. How can I create a named scope that uses an association and a lambda expression for parameterization. For example how would you retrieve all the products that are from a certain category type, for example 'electronics'. When I try something analagous to this I get an error: wrong number of arguments (3 for2).
I would have liked to have seen the content partial -- I don't think you covered them in episodes to this one. Still -- a very good episode and will help me clean up my rails app a bunch.
As usual another great screencast, thanks Ryan.
I am especially enjoying all your recent screencasts dedicated to testing as I felt I needed some extra help on this often underestimated aspect of programming.
Hello Ryan,
The code for this episode seems to be horribly broken? I have references to site_url in the show.html.erb file for articles and that is not even an attribute for the article or comment? Can you or anyone else help? I feel quite lost frankly. Is there something that I am missing? It seems like no one else has these errors show up? I downloaded the code from Github, wrong place?
Please help
Thanks.
Bharat
OK, repeated you tutorial. Just started with Rails and wanted to check out a good TDD scheme for Ruby and found Cucumber & RSpec. The homepages are nice for experts, but not a single step-by-step guide for getting it to work for newbs. Especially the rake commands are given NOWHERE and as a newb the problem with tables reported by Cucumber (if you don't know you need to clone) and the official Cucumber Wiki example actually using a table in the feature got me going crazy... Your railscast on this should become part of the official documentation! Thanks loads, man!!!
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
OK. I think I am doing something silly. I downloaded the code, ran migrations and am trying to enter data to test this. When I enter a new Article, the article gets created, but not the comment and I get an error as follows:
I'm trying to get this code to work from the git repo but its complaining about current_cart in line_items_controller.rb the create on line 4. any ideas?
@Clemens, @erik, good eye, and thank you for pointing this out. I have not found any downside to using "get" at all times for testing this authentication before filter. However the solution Clements gave seems like a great way to handle this issue.
Does your it_should_require_admin_for_actions test what you want it to?
In articles_controller_spec.rb, you wrote out 5 it blocks that test the actions using get, post, put, and delete, but it_should_require_admin_for_actions only runs get on each of the actions. Doesn't it need to run the correct verb on each action, or does it work the way it is?
It should probably be noted that it's not ideal to just get every passed in action in the last macro. Instead, one might use something like the following:
Do you do any testing with shoulda? after banging my head over rspec for the past few days i decided to give it a try but there is not much instruction out there. I bet this cast would have gotten me stick with rspec for a few more days if id seen it earlier. :-p
I've just changed to Ubuntu 8.10 from Win XP. I now need background.
For some reason this episode (only) will not download/play in Ubuntu ?
Is it corrupt ? or possibly encoded differently ? Ajacent episodes, 128,127, 130 play ok.... But 129 ! No go :(
Hi . . i m facing a problem. when i write has_attached_file in my model .. i get an error on running the server that undefined method has_attached_file ,,, please help me solving this problem. i need it urgently... please.. i m using windows , netbeans and have installed paperclip as a gem because it is not available as a plugin,,
... sorry, it seems I should have just read all the comments, see it from
Steve Feb 14, 2009 at 01:50
now. Thanks Ryan, thanks guys, keep up the great job!
Thank you, Ryan. You read my mind. I just wanted to read about Factory Girl. :-)
... small addition. If I use
<%= flash[:error] %>
in a template the message get's displayed but it's not styled.
Hi,
I can't get the message "unauthorized access" from the authorize function to be displayed. Trying to access restricted page when not logged in gets redirected to the home OK but the message isn't displayed. My home model is Type and in the 'index' view (app/views/types/index.html.erb) I have tried:
<%= error_messages_for :type %>
with no success.
The development mode issue some people were having seems to be a rails bug. See: https://rails.lighthouseapp.com/projects/8994/tickets/1339
This patch seems to fix the problem (I haven't tested it personally).
https://rails.lighthouseapp.com/attachments/77318/rebased-20090112-prevented-AR.reset_subclasses-from-killing-existing.patch
I try and login (/login) I get: session_url failed to
generate from {:controller=>"sessions", :action=>"show"} - you may
have ambiguous routes, or you may need to supply additional parameters
for this route. content_url has the following required parameters:
["sessions", :id] - are they all satisifed?
Please help... Where is the mismatch?
I really appreciate your work. It helps me to improve my skills in Rails. Thanks a lot.
Love your screencasts.
This is my first contribution to the RoR community, so I hope it is a help.
I searched a long time for a solution, until I discovered it was right there in will_paginate.
paginate_by_parent_id nil, ...
made it possible to add an extra edge to my finds, so that the search is only for posts that do not have a parent_id.
Could not make this work with :conditions alone.
Here is the code from my model post.rb:
def self.search_list(search, page)
paginate_by_parent_id nil,
:per_page => 5, :page => page,
:conditions => ['title like ? or body like ?',"%#{search}%","%#{search}%"],
:order => 'created_at DESC'
end
Thanks Ryan. This cast did a great job at helping to jumpstart my usage of Prawn. It's a very useful library.
Hi @Ryan,
A breakthrough functionality I got working for myself in a jiffy. Many thanks for your railcasts...
I am using auto_complete on a search field which auto completes a list of tag.names and company.names for Company model. And it is returning for me a collected list of matching Company or Tag names for the search string.
BUT when i select one value from the Autocomplete list, previous string in the autocomplete text-field gets vanished and the selected word takes over.
What if I need multi word values to be submitted in that search field with commas between them ?
like "Comment, Private, Nitin"
And I also got the autocomplete to work after putting a comma..
Help!
Nitin R
Hello, is there a way to using rails-layouts with prawn? I'll render a pdf-page with :layout => "pdf_letter" and inside this layout I using yield. But this will render a pdf file inside the pdf letter layout and is not showing.
There a an example to using prawnto like erb files and layouts in rails?
Hi!
I work on a web application where I have sucessfully implemented this cool behavior.
Thanks Ryan!!!
BUT: I use this auto completion feature on a text field that queries a table with almost 4000 records ( an extensive list of restriction enzymes). The drop down menu goes way off screen at the bottom if the user only types in a single common letter.
I suppose I could limit the number of returned search results but that would possibly prevent the user from finding the correct value.
Is there a way to introduce a scroll bar to the drop down menu?
Cheers Juergen
Is the Download link working? To me it fails, "Safari can't connect to the server".
In response to Stephen's (29.) issue with error messages messing up the second select, I used Peer's solution (61.) placed in the view template, along with a line to update that first option in the select so it didn't show the first option in the list: http://gist.github.com/96784
Thank you, exactly what I need! I love your screencasts. Good job.
what do i need to pass in "visit '/'" to access a page with basic_http_authentication?
i couldn't find anything on the web...
Great screencast as always!!
I am new to BDD and am trying to figure out when it is that one would use rspec in this process? After the Cucumber features pass? Would rspec just get used for unit testing at that point?
Thanks again!
Eric
The only link that works is the "for apple tv" link.. Thx for these screen casts
I can´t install webrat. I always get this error
In file included from ./html_document.h:4,
from html_document.c:1:
./native.h:11:28: error: libxml/xmlsave.h: No such file or directory
Any idea?
@Andrew Nordman
or you could just
redirect_to [@commentable, :comments]
or through my resourceful_parenting plugin (which relieves you from even writing find_commentable):
redirect_to [parent, :comments]
or
redirect_to polymorphic_p_path(:comments)
Whatever you find more readable/maintainable.
does anyone has prawn and prawnto successfully running under rails 2.3.2? i'm getting a "Template is missing" error. Same error applies here (http://www.nabble.com/Prawn-%2B-PrawnTo-%2B-Rails-2.3.2-td22720589.html)
A friend and a business partner of mine, Wojciech Piekutowski, wrote gem that makes Prawn faster by using ImageMagick for PNG processing. You can find it on github: http://github.com/amberbit/prawn-fast-png/tree/master
Hi, Ryan! Great post. thanks!
Do u think there is a way to combine this one with Advanced Search? Whats the hint? :)
Especially those minimum_price & maximum_price in advanced search screencast.. or thinking sphinx only supports ranges?
thanks!
Ryan, or any other expert,
I'm such a fan of named scopes now and see so many opportunities to streamline code. I ran into a problem. How can I create a named scope that uses an association and a lambda expression for parameterization. For example how would you retrieve all the products that are from a certain category type, for example 'electronics'. When I try something analagous to this I get an error: wrong number of arguments (3 for2).
named_scope :retrieve_by_type, :include=>:category, lambda{|type_id| {:conditions=>['categories.type'=type_id]}
-Thanks in advance
Hi Ryan,
same problem here.
How can we fix it?
Thanks
Dario
I would have liked to have seen the content partial -- I don't think you covered them in episodes to this one. Still -- a very good episode and will help me clean up my rails app a bunch.
As usual another great screencast, thanks Ryan.
I am especially enjoying all your recent screencasts dedicated to testing as I felt I needed some extra help on this often underestimated aspect of programming.
Hello Ryan,
The code for this episode seems to be horribly broken? I have references to site_url in the show.html.erb file for articles and that is not even an attribute for the article or comment? Can you or anyone else help? I feel quite lost frankly. Is there something that I am missing? It seems like no one else has these errors show up? I downloaded the code from Github, wrong place?
Please help
Thanks.
Bharat
OK, repeated you tutorial. Just started with Rails and wanted to check out a good TDD scheme for Ruby and found Cucumber & RSpec. The homepages are nice for experts, but not a single step-by-step guide for getting it to work for newbs. Especially the rake commands are given NOWHERE and as a newb the problem with tables reported by Cucumber (if you don't know you need to clone) and the official Cucumber Wiki example actually using a table in the feature got me going crazy... Your railscast on this should become part of the official documentation! Thanks loads, man!!!
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
Have a good 1 buddy.
ups... should be:
# config/routes.rb
map.resources :articles
missing in your code listing:
# config/routes.rb
map.resource :articles
OK. I think I am doing something silly. I downloaded the code, ran migrations and am trying to enter data to test this. When I enter a new Article, the article gets created, but not the comment and I get an error as follows:
ActiveRecord::UnknownAttributeError (unknown attribute: article):
app/controllers/articles_controller.rb:8:in `new'
app/controllers/articles_controller.rb:8:in `show'
/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.4/lib/ruby-debug.rb:96:in `debug_load'
/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.4/lib/ruby-debug.rb:96:in `main'
/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.4/bin/rdebug-ide:76
/usr/local/bin/rdebug-ide:19:in `load'
/usr/local/bin/rdebug-ide:19
here is the line of code in the articles_controller in show action:
@comment = Comment.new(:article => @article)
Anyone else get that, how should I fix it?
Thanks.
Bharat
Hello,
Ryan, many thanks for your excellent video tutorials.
Im a total ruby/rails beginner and I do not get this search to work. Would it be possible to paste all the code which concerns this search?
I would like to have a look at the:
- search controller
- _products.erb partial
It would also make this tutorial a bit more beginner-friendly if those where included.
regards
As a new person to tests and RSpec I have a problem getting my head around one thing:
How do the tests you write get integrated back into the code of the application? And how do methods like login_as_admin get used in the application?
If I'm writing code to make tests easier, shouldn't that code also make coding the application easier?
I'm trying to get this code to work from the git repo but its complaining about current_cart in line_items_controller.rb the create on line 4. any ideas?
@Clemens, @erik, good eye, and thank you for pointing this out. I have not found any downside to using "get" at all times for testing this authentication before filter. However the solution Clements gave seems like a great way to handle this issue.
Using this method to update the positions of records, how do you get a sweeper to fire? The only way I've been able to do it is with this method:
http://gist.github.com/94735
Unfortunately, it fires once for every record that is updated. Is there a better way to get it to fire only once?
Does your it_should_require_admin_for_actions test what you want it to?
In articles_controller_spec.rb, you wrote out 5 it blocks that test the actions using get, post, put, and delete, but it_should_require_admin_for_actions only runs get on each of the actions. Doesn't it need to run the correct verb on each action, or does it work the way it is?
Thank you very much.
Awesome, custom rspec matchers for Moonshine are in my backlog. You just saved me a lot of time :).
Good stuff. :) The RSpec RDoc on matchers is very confusing but your screencast is very easy to understand.
It should probably be noted that it's not ideal to just get every passed in action in the last macro. Instead, one might use something like the following:
http://gist.github.com/94405
Do you do any testing with shoulda? after banging my head over rspec for the past few days i decided to give it a try but there is not much instruction out there. I bet this cast would have gotten me stick with rspec for a few more days if id seen it earlier. :-p
Found no better place for it: Thanks a lot for your excellent site! I'm just starting with rails and your screencasts are a great help.
Is there any prospect of paperclip integrating an upload progress meter?
My English listening is really weak :-)
Update _ just to clarify....
I *can* save it to my Ubuntu desktop and play it.
Denis
ps
These railcasts are brilliant. Take a bow Ryan.
I've just changed to Ubuntu 8.10 from Win XP. I now need background.
For some reason this episode (only) will not download/play in Ubuntu ?
Is it corrupt ? or possibly encoded differently ? Ajacent episodes, 128,127, 130 play ok.... But 129 ! No go :(
In XP , it plays no problem.
Denis