Re: [Rails] How do I set rails generator properties?

2013-01-13 Thread Colin Law
On 13 January 2013 01:55, tamouse mailing lists tamouse.li...@gmail.com wrote: In a rails app I'm working on, when I invoke `rails generate scaffold Model` it uses the `inherited_resources_controller` instead of `scaffold_controller`. I'm not sure when it started doing this, but I'd like it to

Re: [Rails] sudo gem install rails not working because of problem with alias_method and is_file

2013-01-13 Thread Colin Law
On 13 January 2013 02:29, Alex M. li...@ruby-forum.com wrote: I had downloaded ruby, rails, and rubygems previously on my hard drive when I ran Windows. I just downloaded Ubuntu and tried to use RoR but it wasn't working, so I figured I had to follow the installation procedure listed here

[Rails] Re: Send mail on Rails.logger.error

2013-01-13 Thread Crispin Schäffler
I don't really know that much about the interns of Rails.logger.error method but how about overwriting it for your app? use alias on the old method and do something like this: alias :old_error :error def error # send your mail or whatever old_error end would at least do its job without

[Rails] Re: weird startup OS X time zone issue

2013-01-13 Thread Crispin Schäffler
config.time_zone = Time.zone || UTC is what you are looking for. The Time.zone command looks into the local time zone set for the user visiting your current page and returns it, if not found it will return the UTC Time zone. In your case looking up the timezone of the server it is running on

Re: [Rails] Re: Send mail on Rails.logger.error

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 5:42 AM, Crispin Schäffler crispinschaeff...@gmail.com wrote: I don't really know that much about the interns of Rails.logger.error method but how about overwriting it for your app? use alias on the old method and do something like this: alias :old_error :error def

Re: [Rails] Re: Send mail on Rails.logger.error

2013-01-13 Thread Crispin Schäffler
Yeah, as I told, i don't know the insides of the error method or the correct specification.. Just wanted to give a hint how you could do it to get it to work quickly and without much trouble. And in my opinion its not that dirty to alias a function if you know what you do. Sure you can use a

Re: [Rails] Re: Send mail on Rails.logger.error

2013-01-13 Thread Crispin Schäffler
Just wanted to give a hint that it's not that hard to make it work. Your approach is much cleaner and should be used of course. Am Sonntag, 13. Januar 2013 13:00:50 UTC+1 schrieb Jordon Bedwell: On Sun, Jan 13, 2013 at 5:42 AM, Crispin Schäffler crispins...@gmail.com javascript: wrote: I

Re: [Rails] Re: Send mail on Rails.logger.error

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 6:06 AM, Crispin Schäffler crispinschaeff...@gmail.com wrote: Yeah, as I told, i don't know the insides of the error method or the correct specification.. Just wanted to give a hint how you could do it to get it to work quickly and without much trouble. And in my

[Rails] Rspec: How to test create action in controller

2013-01-13 Thread Peter
Hi Everyone, (using rails 3.2.11) I've searched high and low for the answer to this, so now I have to submit a question... # describe POST on Users#create do # before { post users_path } # specify { response.should redirect_to(root_path) } # end Every time I

Re: [Rails] Rspec: How to test create action in controller

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 5:23 AM, Peter pe...@poproj.com wrote: I've searched high and low for the answer to this, so now I have to submit a question... # describe POST on Users#create do # before { post users_path } # specify { response.should redirect_to(root_path) }

Re: [Rails] Rspec: How to test create action in controller

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 9:17 AM, Jordon Bedwell envyge...@gmail.com wrote: MyController ApplicationController def my_action redirect_to :back unless params[blah] == blah render :my_template end end Should be: MyController ApplicationController def my_action

[Rails] Nested models in a form

2013-01-13 Thread Rafael C. de Almeida
Hello, I'm trying to work with nested models in a form view and it's not going so smoothly. A user has many lawyers and a lawyer can take many services. I want a checkbox on which the user can select the services of each lawyer. How can I do it? This is what I've got so far: %= form_for @user

[Rails] Re: Nested models in a form

2013-01-13 Thread Rafael C. de Almeida
I have found out that user[lawyers_attributes][0][service_ids][] works for the first lawyer (I update 0 to 1 for the second and so on). However, that seems rather ugly. Is thera a way to extract the path user[lawyers_attributes][0] from lf object? On Sunday, January 13, 2013 4:06:21 PM UTC-2,

[Rails] Re: Nested models in a form

2013-01-13 Thread Rafael C. de Almeida
Let me send you another post the intention of documenting this issue for people from the future. The solution I'm going with for now is: substituting ??? for lf.object_name+[service_ids][]. It may not be too pretty, but it works (don't forget setting :service_ids in attr_accessible and

Re: [Rails] Re: Nested models in a form

2013-01-13 Thread Jim Ruther Nill
On Mon, Jan 14, 2013 at 5:15 AM, Rafael C. de Almeida almeida...@gmail.comwrote: Let me send you another post the intention of documenting this issue for people from the future. The solution I'm going with for now is: substituting ??? for lf.object_name+[service_ids][]. It may not be too

Re: [Rails] How do I set rails generator properties?

2013-01-13 Thread tamouse mailing lists
On Sun, Jan 13, 2013 at 3:42 AM, Colin Law clan...@googlemail.com wrote: On 13 January 2013 01:55, tamouse mailing lists tamouse.li...@gmail.com wrote: In a rails app I'm working on, when I invoke `rails generate scaffold Model` it uses the `inherited_resources_controller` instead of