[Rails] running model methods from command line

2012-07-01 Thread bingo bob
hi chaps - i've got a project where I have very limited resources on the device rails runs on (raspberry pi) - basically i have rails server running… then periodically i fire off rails runner Model.method (from an external program on the device)…. all works fine but it's terribly slow - I think

Re: [Rails] running model methods from command line

2012-07-01 Thread Nielson Rolim
Try create just a ruby script and include 'rubygems' and 'active_record': |#!/path/to/ruby ||require'rubygems'| |require'active_record'| You must include all the models you need also. Then give execute permission to your script: |chmod a+x myscript.rb| -- Nielson Rolim

[Rails] Re: find_by_sql and join

2012-07-01 Thread Frederick Cheung
On Jun 30, 10:08 am, tanizawa kazuyat7...@gmail.com wrote: hi I amd tanizawa. I had problem. I can not get main.name value from below sql.   find_by_sql 'select main.id,main.name,sub.name from main left join sub on sub.id = main.id' Please teach me how to get borth name value.

[Rails] undefined method `xxx_path' for ##Class....

2012-07-01 Thread Rafal Gawlik
when i try /contact_mail/newi it return me error: undefined local variable or method `em' for ##Class:0x007fca24248858:0x007fca21186df0 model: contact_mail.rg class ContactMail ActiveRecord::Base attr_accessible :email, :message, :name, :subject end controler:

[Rails] Re: edit a collection item in _form for the parent

2012-07-01 Thread Andrew Ferk
While I believe it is possible to use fields_for, as you mentioned in your replies, you do not have to. Here is a possible solution: # app/controllers/dogs_controller.rb class DogsController ApplicationController def new @dog = Dog.new @legs = Leg.where(:dog_id = nil) end def

[Rails] a hands-on tutoring needed

2012-07-01 Thread sehrguey o.
dear each, and all and others, being a completeest newbie to RoR and having got dumb by a month or so of googling how to add search faculty to a web app, I ask you for help. All I got is a database of 200 records so there is no need for sphinxes, sunspots, elasticsearches, searchlogics, ferrets

Re: [Rails] a hands-on tutoring needed

2012-07-01 Thread Bill Walton
Hi Sehrguey, On Sun, Jul 1, 2012 at 8:04 AM, sehrguey o. li...@ruby-forum.com wrote: dear each, and all and others, being a completeest newbie to RoR and having got dumb by a month or so of googling how to add search faculty to a web app, I ask you for help. All I got is a database of 200

Re: [Rails] a hands-on tutoring needed

2012-07-01 Thread Walter Lee Davis
On Jul 1, 2012, at 9:04 AM, sehrguey o. wrote: dear each, and all and others, being a completeest newbie to RoR and having got dumb by a month or so of googling how to add search faculty to a web app, I ask you for help. All I got is a database of 200 records so there is no need for

Re: [Rails] running model methods from command line

2012-07-01 Thread Scott Ribe
On Jul 1, 2012, at 5:37 AM, Nielson Rolim wrote: Try create just a ruby script and include 'rubygems' and 'active_record': You might also want (for the connection follow what's in your database.yml): ActiveRecord::Base.establish_connection({ adapter: ... }) And you might want to require

[Rails] How to become effective and professional in Rails?

2012-07-01 Thread Sam Serpoosh
Dear Group, I know that this kind of question may sound not very good to you. But I just wanted to ask you that what is the best way to become perfectly effective and professional with good knowledge in rails. I'm a software developer with almost 2.5-3 years of experience. a TDD, BDD and

[Rails] Re: edit a collection item in _form for the parent

2012-07-01 Thread sheamus
Thank. Yeah, I basically ended up doing something similar. I use 'leg[]' in my select tag, and then manually hooked things up in the back end I wonder if in your solution if things would have been connected for me? Never mind just tried it, I still have to hook things up manually in the

[Rails] Re: edit a collection item in _form for the parent

2012-07-01 Thread Andrew Ferk
S, You should not have to do any manual association. If you have params[:dog][:leg_ids] = [...], it should work; you may need to set attr_accessible :leg_ids in your Dog model. Show your solution, and maybe we can refactor it to use less code. -- Andrew Ferk On Sunday, July 1, 2012 10:39:14

[Rails] Re: edit a collection item in _form for the parent

2012-07-01 Thread Andrew Ferk
S, You should not have to do any manual association. If you have params[:dog][:leg_ids] = [...], it should work; you may need to set attr_accessible :leg_ids in your Dog model. Show your solution, and maybe we can refactor it to use less code. -- Andrew Ferk On Sunday, July 1, 2012 10:39:14

[Rails] Re: Rspec - want to NOT clear database between tests

2012-07-01 Thread Carilda Thomas
Martin Streicher wrote in post #1066742: before(:all) seems well-suited to this problem. It creates data that persists across transactions. https://www.relishapp.com/rspec/rspec-rails/docs/transactions Thank you but (after much googling) I discovered that one cannot load fixtures in

[Rails] Re: edit a collection item in _form for the parent

2012-07-01 Thread sheamus
Ahhh, got it working as you said now. Great thanks. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/RJvnPzGPAqAJ. To post to this group, send

[Rails] slow development compiling with asset pipleine

2012-07-01 Thread S Ahmed
I don't have much experience with the new asset pipleine, but when developing locally it seems things are very very slow to compile now. Am I missing something or is this how the new asset pipleine rails version is? -- You received this message because you are subscribed to the Google Groups