This is driving me batty. The project AND task create fine, but project_id in the task is NULL, so the task gets essentially "lost" in the db. One thing I notice in the log is that the sql "Task Create" is happening before the sql "Project Create" -- so the (parent) project doesn't HAVE an id when the (child) task is being created. Any idea how to fix?
For some reason, when I submit my form it seems to create both the project and tasks, but the tasks get created with a NULL value for "project_id", so they're not being understood as the project's children. Any idea how this might be happening or how to manually correct it?
Ryan B. You make the world a better place. I can always find great content here and for your main focus to be sharing info rather than promoting info, it shows you have lot of character. Your mom should be proud.
I am experiencing the same difficulty as No. 11: Michael Dec 25, 2007.
In 12 Michael Dec 25 he states "I have forgotten the require 'yaml', SORRY!"
Can you tell me what he is referring to and where to place the 'require yaml'
Thank you all WHAT A GREAT RESOURCE!
adding the "join the beta" page, I noticed that when there's a validation error, it shows up back on the normal "new invitation" page. any way to do that differently?
Doing this allowed me to prevent my previous links to the standard signup page from throwing errors, whilst haveing the new _with_token route for the invites. Thanks for a great episode, Ryan!
Is there a way to monitor the task in the "new" event, and if it already exists select the existing id rather than creating a new one. That would be awesome, but I'm stumped, and I'm a noob.
I upgraded an app that I'm working on from rails 2.1.2 to 2.2.2 and now my rtex pdf generation does not work. It appears that the latex file is never run through the processor so no PDF is every created, you just get the latex file with a .pdf extension.
@Andrea: Yes, models, attributes and validation messages can be translated as well as time/date formats or e.g. output of distance_of_time_in_words. You might want to have a look at the various "localized_dates" and "rails-i18n" repositories on github.
Thanks! Great episode! But what about models and validation translation? Is possibile with I18n? If so maybe you could show us how to with an advanced episode xD
Finally rails 2.2 released!
This is what I was waiting for :)
Hey Ryan thanks for all screencasts till yet!
I hope you will put more screencasts ASAP on rails 2.2
Thanks again Ryan for this great tutorial. In the past, I have used Globalize to translate UI content. Sometimes when the layout was a little bit different from english to french, it was more easy just to create an other view to handle the job. Something like index.fr.html.erb. Can we do so in 2.2?
Thanks so much for all your work. Question - I'm seeing that
scope = Product.scoped({})
is indeed doing a find which is undesired in my case. I'm on Rails 2.1. I'd like to build up the scopes before executing. Do I need to use your scope_builder?
But when i use it for my project
i get an uninitialized constant error.
I have a payslip model which has many payslip adjustments
so the statement @payslip.payslip_adjustments.build raises the error "Uninitialised constant" Any help will be appreciated. Thanks
The code as implemented here seems to be able to handle bogus tokens (e.g., "123"), but not the absence of a token -- when I point my browser to localhost:3000/signup/ I get
Routing Error
No route matches "/signup/" with {:method=>:get}
Is there an easy way to remedy this?
Perhaps when no token is supplied, the behavior can be to go to that "add your email"-type page detailed at the end...? But more importantly, how to avoid the crash?
using the browser settings is one of the step toward presenting the correct language... at the same time limiting yourself to the preferred language of the browser would detract some of your users (for example, my browser here has a french default but I still prefer to view some sites in english, even when french is offered).
At the same time, you have to take in account that browsers are not the only client your website will have (I can still recall one website I was asked to look into, they were indexed in one of the three languages the site was available into... the reasons... language selection was done through cookies and search engines don't understand cookies).
The language selection process is important. I usually take an approach similar to the ibm.com website (having the locale being part of the url)... as Ryan suggests, sub-domains can achieve the same trick.
What if Wookie would like to enter some number in the form? The application needs to convert this number and probably save it to db. What are best practices to achive that?
Sorry if this discussion is very old by now... with regard to @bijou, @peter, @mike, etc.: I wrote a plugin recently that allows you to use text_field_with_auto_complete with fields_for so that it can be repeated multiple times in a single form.
Great screencast...the only thing missing is database translations.
Also, once you start translating the units of currency, you'll have to start converting prices from say "dollars to euros". Either dynamically based on the current exchange rate, or hard coded somewhere.
@Jean, you could do this fairly easily with subdomains. Since the language is set in a before filter you could combine this episode with #123 on subdomains.
http://railscasts.com/episodes/123-subdomains
Translating the text and formats has always been important but it's half the battle when it comes to internationalization.
The other half is letting the user choose the language and having those pages being indexed in their specific languages.
I personally like to have the language as part of the URL because it makes for a very simple selection mechanism (and it makes every entities distinct one even for the search engines).
@Ben, I may cover model translation after this series on Rails 2.2 is done, thanks for the suggestion.
@Andrew, the "current_user" in my case is actually a method call. I prefer this over a before_filter which sets a @current_user because it will only load the current user if it needs access to it, not on every page all the time.
Any decent web application need to have localisation sooner or latter. Now this task is much easer and this screen cast is great first step in localisation process.
Another great Railscast! Sorry that this is off topic, but I've been using the instance variable @current_user in my Rails app. Would switching to the local variable reap any benefits (like speed improvements?) Thanks!
This is driving me batty. The project AND task create fine, but project_id in the task is NULL, so the task gets essentially "lost" in the db. One thing I notice in the log is that the sql "Task Create" is happening before the sql "Project Create" -- so the (parent) project doesn't HAVE an id when the (child) task is being created. Any idea how to fix?
For some reason, when I submit my form it seems to create both the project and tasks, but the tasks get created with a NULL value for "project_id", so they're not being understood as the project's children. Any idea how this might be happening or how to manually correct it?
Woohoo!
Thank you, thank you, thank you!
Great screencast and exactly what I needed.
Wll test this one on my own, thanks
I should try those codes, thanks
Ryan B. You make the world a better place. I can always find great content here and for your main focus to be sharing info rather than promoting info, it shows you have lot of character. Your mom should be proud.
I'm not clear on what the user_name and pass are the user/pass TO. Can you explain?
excellent stuff, helped out my cms setup.
love the capistrano stuff, will simplify things greatly ;-)
How we can use OR condition in Sphinx ?
Eg. (zip!='' AND zip is NOT NULL) OR (is_nationwide=1)
I am experiencing the same difficulty as No. 11: Michael Dec 25, 2007.
In 12 Michael Dec 25 he states "I have forgotten the require 'yaml', SORRY!"
Can you tell me what he is referring to and where to place the 'require yaml'
Thank you all WHAT A GREAT RESOURCE!
adding the "join the beta" page, I noticed that when there's a validation error, it shows up back on the normal "new invitation" page. any way to do that differently?
Think I figured it: the key would just be to create a second name in the routes, so you'd end up with
map.signup '/signup', :controller => 'users', :action => 'new'
map.signup_with_token '/signup/:invitation_token', :controller => 'users', :action => 'new'
Doing this allowed me to prevent my previous links to the standard signup page from throwing errors, whilst haveing the new _with_token route for the invites. Thanks for a great episode, Ryan!
Hi Ryan,
Is there a way to monitor the task in the "new" event, and if it already exists select the existing id rather than creating a new one. That would be awesome, but I'm stumped, and I'm a noob.
Thanks,
Chris
I upgraded an app that I'm working on from rails 2.1.2 to 2.2.2 and now my rtex pdf generation does not work. It appears that the latex file is never run through the processor so no PDF is every created, you just get the latex file with a .pdf extension.
Moving back to rails 2.1.2 fixes the problem.
Hi,
Wanted to let you guys know that there's a new version of the preference pane. v1.2
http://www.fngtps.com/2008/12/passenger-preference-pane-v1-2
Cheers,
Eloy
@Andrea: Yes, models, attributes and validation messages can be translated as well as time/date formats or e.g. output of distance_of_time_in_words. You might want to have a look at the various "localized_dates" and "rails-i18n" repositories on github.
Thanks! Great episode! But what about models and validation translation? Is possibile with I18n? If so maybe you could show us how to with an advanced episode xD
Finally rails 2.2 released!
This is what I was waiting for :)
Hey Ryan thanks for all screencasts till yet!
I hope you will put more screencasts ASAP on rails 2.2
Power Pack Performance of rails 2.2 !!!!
can this be used in os commerce?
Thanks again Ryan for this great tutorial. In the past, I have used Globalize to translate UI content. Sometimes when the layout was a little bit different from english to french, it was more easy just to create an other view to handle the job. Something like index.fr.html.erb. Can we do so in 2.2?
Thanks
Marc
@Asis and @Justin
Passenger did not support background processes until the latest version 2.0.4. Just update your version of Passenger and all should work perfectly.
Per comment #44 by me:
I was in the console when testing this. Appears to be ok when running in Rails.
Sorry for any confusion. Still seems a bit weird though.
Hi Ryan,
Thanks so much for all your work. Question - I'm seeing that
scope = Product.scoped({})
is indeed doing a find which is undesired in my case. I'm on Rails 2.1. I'd like to build up the scopes before executing. Do I need to use your scope_builder?
Thanks!
I searched for dynamic menus in Ruby and your article helps me a lot... Thanks for posting it. Great help!
default_url and default_style are also useful options.
See paperclip.rb in the code for explainations.
You really helped me out with this. Thank you very much!
Great Tutorial
But when i use it for my project
i get an uninitialized constant error.
I have a payslip model which has many payslip adjustments
so the statement @payslip.payslip_adjustments.build raises the error "Uninitialised constant" Any help will be appreciated. Thanks
Thanks again for this great episode!
Just what I have been looking for!
Very useful screencast - thank you Ryan.
And thank you for the TextMate Theme
too :-) veeery nice
The code as implemented here seems to be able to handle bogus tokens (e.g., "123"), but not the absence of a token -- when I point my browser to localhost:3000/signup/ I get
Routing Error
No route matches "/signup/" with {:method=>:get}
Is there an easy way to remedy this?
Perhaps when no token is supplied, the behavior can be to go to that "add your email"-type page detailed at the end...? But more importantly, how to avoid the crash?
Thanks!
Ryan,
I don't see how /shared/config/database.yml gets created.
Did you create the /shared/config directory and place the database.yml file into that directory manually before running the cap script.
Thanks for the screencasts!
@Steve,
using the browser settings is one of the step toward presenting the correct language... at the same time limiting yourself to the preferred language of the browser would detract some of your users (for example, my browser here has a french default but I still prefer to view some sites in english, even when french is offered).
At the same time, you have to take in account that browsers are not the only client your website will have (I can still recall one website I was asked to look into, they were indexed in one of the three languages the site was available into... the reasons... language selection was done through cookies and search engines don't understand cookies).
The language selection process is important. I usually take an approach similar to the ibm.com website (having the locale being part of the url)... as Ryan suggests, sub-domains can achieve the same trick.
Jean-Marc
Nice screencast, as always, thanks!
What if Wookie would like to enter some number in the form? The application needs to convert this number and probably save it to db. What are best practices to achive that?
Sorry if this discussion is very old by now... with regard to @bijou, @peter, @mike, etc.: I wrote a plugin recently that allows you to use text_field_with_auto_complete with fields_for so that it can be repeated multiple times in a single form.
See: http://github.com/pat11639/repeated_auto_complete
Hope this helps someone!
Nice Screencast!
Maybe it is nice to add something like routes translations? Is that even possible?
Is there any reason an application shouldn't display the preferred locale set in the browser? Is there an easy way to access this locale?
@Jean-Marc: that should be easy. You could e.g. use a (configurable) constant hash as a tld=>locale lookup, e.g.
TLD_LANGS = { 'com' => 'en', 'de' => 'de' }
and use a before_filter in ApplicationController to set the locale based on the current request host like
I18n.locale = TLD_LANGS[request.host.split('.').last] || 'en'
Locale is pronounced "loh-CAL".
Good work Ryan, like always. ;-)
i18n is very important and this screencast is a good start to start with internationalization.
Hi Brian, thank you very much for your great and helpful screencasts!
I want to add one hint for a problem I run into:
If your daemon requires Rails and it's not the latest version you actually have on your machine, the daemon startup fails, because the
require 'activesupport'
from the _ctl script first loads the higher version and afterwards the real daemon tries to load a lower one. Replacing this "require" by
gem 'activesupport', '=2.1.2'
require 'active_support'
did the job. Maybe something one could add to the templates / script_ctl somehow?
Your's Frank
Great screencast...the only thing missing is database translations.
Also, once you start translating the units of currency, you'll have to start converting prices from say "dollars to euros". Either dynamically based on the current exchange rate, or hard coded somewhere.
@Jean, you could do this fairly easily with subdomains. Since the language is set in a before filter you could combine this episode with #123 on subdomains.
http://railscasts.com/episodes/123-subdomains
Translating the text and formats has always been important but it's half the battle when it comes to internationalization.
The other half is letting the user choose the language and having those pages being indexed in their specific languages.
I personally like to have the language as part of the URL because it makes for a very simple selection mechanism (and it makes every entities distinct one even for the search engines).
You have any thoughts on that level??
@Ben, I may cover model translation after this series on Rails 2.2 is done, thanks for the suggestion.
@Andrew, the "current_user" in my case is actually a method call. I prefer this over a before_filter which sets a @current_user because it will only load the current user if it needs access to it, not on every page all the time.
@David, thanks, marked.
Thanks for this screencast!!
@Ben:
For the model translation there is Globalize2 http://github.com/joshmh/globalize2/tree/master
Woohoo!
Have been waiting for this screencast. Will have to watch it when i'm back at home...
Any decent web application need to have localisation sooner or latter. Now this task is much easer and this screen cast is great first step in localisation process.
Awsome!
Does anyone know if it will be possible to have some specific locale strings into engines?
Another great Railscast! Sorry that this is off topic, but I've been using the instance variable @current_user in my Rails app. Would switching to the local variable reap any benefits (like speed improvements?) Thanks!