[Rails] How to refresh a parent page

2010-03-16 Thread Sameera Gayan
Hi Guys, I have the fllowing requirement, I have a model called Task to display user tasks 1 . Link to add a new task (in the tasks index page) 2 . when a user click the link, 'tasks/new' action will open up inside a popup 3 . when the user save the new task, I want to close 'new task' popup

[Rails] Before_filters on re-rendered methods - what is the correct RAILS way?

2010-03-16 Thread Chris Mayan
Hello, My Question: How can one have the equivalent of before_filter checking (e.g. to require a user to be logged in before carrying out an action) on a method when the method is called implicitly inside another action (the before_filter doesn't seem to get run)? Background:

[Rails] Rails + Mysql

2010-03-16 Thread José Luis Romero
Hi... I'm a rails newb, trying to do some rails homework or sort of... I'm trying to run rails on Fedora 12... but it seems impossible... It's impossible to install the mysql gem... this is the last output when I tried to run a rake db:migrate: uninitialized constant MysqlCompat::MysqlRes Any

[Rails] Re: Trying to create search filter persistence using SearchLogic

2010-03-16 Thread tonypm
I have done something along these lines using a database store. I dont use SearchLogic, but build my searches using anonymous scope and also use Thinking Sphinx. I have a search model with attributes as below: Where the search was made from: t.string user t.string model_name

[Rails] Logging in Rails

2010-03-16 Thread Tom Mac
Hi I dont know much about logging in rails? Could anybody please explain how to do that in a live application? Or point me to any latest links which gives a detailed description of how to do this for different environments in rails? Why I am asking this is, I don't know where to start. But

Re: [Rails] Logging in Rails

2010-03-16 Thread Colin Law
On 16 March 2010 09:03, Tom Mac li...@ruby-forum.com wrote: Hi    I dont know much about logging in rails? Could anybody please explain how to do that in a live application? Or point me to any latest links which gives a detailed description of how to do this for different environments in

[Rails] Re: validates_presence_of :parent_id stopping save

2010-03-16 Thread Max Williams
paul h wrote: Hi Max, Have you tried: @question = Question.create(attributes) @grading = @question.gradings.build(more_attrs) Using create instead of new will save the Object to the DB first, and hence: Hi Paul. Yes, i know that, thanks - in this situation i would do

Re: [Rails] Logging in Rails

2010-03-16 Thread anl hp
Also take a look at Ruby's Logger documentation http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/ -- anl On Tue, Mar 16, 2010 at 10:22 AM, Colin Law clan...@googlemail.com wrote: On 16 March 2010 09:03, Tom Mac li...@ruby-forum.com wrote: Hi I dont know much about logging in rails?

[Rails] DB in Non-Standard Place

2010-03-16 Thread Anthony Gardner
I'll be doing a deployment soon and looking ahead to the future, I was wondering what people do with regarding putting a SQLite db in a non standard place. The simplest solution to get it out of the app is to move it to another directory and have rails find it at server startup. Where can I put

[Rails] Re: Logging in Rails

2010-03-16 Thread Tom Mac
Hi Thanks for all reply. When googling I saw this http://toolmantim.com/thoughts/logging_rails_to_syslog_with_sysloglogger Since a beginner I am asking what will be the advantage if using above? And also I would like to know what are the latest happenings like this Thanks Tom --

Re: [Rails] Re: Logging in Rails

2010-03-16 Thread Colin Law
On 16 March 2010 10:44, Tom Mac li...@ruby-forum.com wrote: Hi   Thanks for all reply. When googling I saw this http://toolmantim.com/thoughts/logging_rails_to_syslog_with_sysloglogger    Since a beginner I am asking what will be the advantage if using above? And also I would like to know

[Rails] Re: Re: Logging in Rails

2010-03-16 Thread Tom Mac
Hi Colin Thanks for replying back. One more thing I need to clarify is when to use the different levels for logging? For example say in controller we can write logger.info some thing or logger.warn something How can we know that we should chose this here say info or warn here? Is

Re: [Rails] Re: Re: Logging in Rails

2010-03-16 Thread Anthony Gardner
If, in your application you are expecting value_a but it's either nil or you have another value, that could be logger.error (if it's critical to the continuation of the application) or if you can work around it but want to be notified about it to sort it out in the future it could be logger.warn,

Re: [Rails] Re: Re: Logging in Rails

2010-03-16 Thread anl hp
I'm always use debug in development because that's why I use it for, debug my app, better yet, change the default logger of Rails in your environment to point to STDERR and you'll see your debug messages in the server shell via guides.rubyonrails.org ActiveRecord::Base.logger = Logger.new(STDERR)

Re: [Rails] Re: xss

2010-03-16 Thread Jeremy Chase
I agree; it has never made sense to me to have to sanitize the output. Escaping everything as you display it does have the benefit of allowing you to see what information is in the DB. Also you can change which tags are allowed after the fact by using sanitize() instead of h() The downside is

[Rails] Re: DB in Non-Standard Place

2010-03-16 Thread Frederick Cheung
On Mar 16, 10:15 am, Anthony Gardner antsmailingl...@gmail.com wrote: I'll be doing a deployment soon and looking ahead to the future, I was wondering what people do with regarding putting a SQLite db in a non standard place. The simplest solution to get it out of the app is to move it to

Re: [Rails] find_by

2010-03-16 Thread Surender Pareek
On Mon, Mar 15, 2010 at 4:17 PM, M I R m.irfa...@gmail.com wrote: hi, I have to retrieve data from table with two conditions using a actully the following query select * from abc where id=1 and type = 'a' how will i do if: find_by_id(id) how will i use for multiple conditions -- You

[Rails] Re: How to configure nested routers to omit controller from URL?

2010-03-16 Thread petr.blaho
Hi, I have the same problem but I need to omit both users and pie_charts from url... and my pie_charts has many others nested resources. If someone know how to do it, please, tell us. With regards Petr Blaho On 6 bře, 23:26, Steve Wilhelm li...@ruby-forum.com wrote: I have the following

[Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

2010-03-16 Thread Clay H.
On Mar 15, 9:25 pm, Michael Pavling pavl...@gmail.com wrote: Using Enumerable.group_by: Stock.all.group_by{|s| [s.medicine.name, s.route.name, s.strength]}.each do |s|   puts #{s.first.inspect} #{s.last.sum(:amount_received) - s.last.sum(:amount_dispensed)} end Does that give you enough

[Rails] Re: RESTful route question

2010-03-16 Thread Dudebot
On Mar 15, 7:59 am, daphonz cdre...@gmail.com wrote: Have you tried just making a hidden field for the patient id? BTW % form_tag group_labs_path, :method = :get do % %= hidden_field_tag :patient_id, @patient.id % works perfectly of course :) (Thanks!) But I still don't understand

[Rails] Get content from HTML element in Rails

2010-03-16 Thread Ignace S.
Hey, I'm looking for a way to get the content of my div in my Rails view. I would like the literal HTML content, so only HTML and no Rails I thought inner_html would work, but I get a RJS exception (TypeError: $(content).innerHtml is not a function) Does anyone know how I can get the content?

Re: [Rails] Re: xss

2010-03-16 Thread Michael Pavling
On 16 March 2010 11:41, Jeremy Chase jeremych...@gmail.com wrote: things should just be sanitized before insertion into the DB and forgo the h(). Just my opinion. I still use h() and sanitize() Two problems with that: The first and smallest is an annoyance. If I want to save my blog in a db,

Re: [Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

2010-03-16 Thread Michael Pavling
On 16 March 2010 12:03, Clay H. cchea...@gmail.com wrote: On Mar 15, 9:25 pm, Michael Pavling pavl...@gmail.com wrote: Using Enumerable.group_by: Stock.all.group_by{|s| [s.medicine.name, s.route.name, s.strength]}.each do |s|   puts #{s.first.inspect} #{s.last.sum(:amount_received) -

[Rails] what is the proper role of seed data?

2010-03-16 Thread Grary
Hi, In my Rails app, I have some parameters whose values change only infrequently. These parameters are used in computations. Where is the place for data like this -- data that is particular to the application? On the one hand, I might think a flat file (yaml) is appropriate, but maybe I

[Rails] Recommendations for pdf generators

2010-03-16 Thread ct9a
hi, everyone, i have googled around for some pdf generators. Found 1) PDF::Writer which is a little dated 2) Rupdf (http://scoop.simplyexcited.co.uk//2007/12/15/rupdf-simple- ruby-pdf-rails-plugin/ and http://agilewebdevelopment.com/plugins/rupdf) - it's a little dated. Last revision was on

[Rails] Retaining file object

2010-03-16 Thread Karthikragunath Bhavani
Dear All, I have a form with file upload option and others input fields. if a user makes error in any input field is it possible to show the form again with the error msg and input field populated with the file object so that user can correct the mistake alone and submit the form again

Re: [Rails] Recommendations for pdf generators

2010-03-16 Thread Michael Pavling
On 16 March 2010 12:56, ct9a anexi...@gmail.com wrote: Any recommendations for pdf generators? Prawn http://wiki.github.com/sandal/prawn/ -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

[Rails] Re: what is the proper role of seed data?

2010-03-16 Thread Robert Walker
Grary wrote: Hi, In my Rails app, I have some parameters whose values change only infrequently. These parameters are used in computations. Where is the place for data like this -- data that is particular to the application? On the one hand, I might think a flat file (yaml) is

[Rails] Re: Upgrading a 1.1.2 RoR App

2010-03-16 Thread Roch Delsalle
Hi, Thanks for your answer, I'm going to try that. What do you mean by if you can vendor rails into your repository ? Is it still possible to run a 1.1.2 Rails App on Heroku or any other RoR Hosting? Regards, Roch On Mar 16, 2:40 am, Rob Biedenharn r...@agileconsultingllc.com wrote: On Mar

Re: [Rails] DB in Non-Standard Place

2010-03-16 Thread Colin Law
On 16 March 2010 10:15, Anthony Gardner antsmailingl...@gmail.com wrote: I'll be doing a deployment soon and looking ahead to the future, I was wondering what people do with regarding putting a SQLite db in a non standard place. I believe that sqlite is not recommended for production. Colin

[Rails] Re: what is the proper role of seed data?

2010-03-16 Thread Grary
Robert, Thanks for your reply, you really nail it: Instead I would use either a static configuration file or use the database. For data that I would never want the users to be able to change I would use a configuration file (a sort of property list). For data that could possibly be altered

[Rails] Re: Recommendations for pdf generators

2010-03-16 Thread Grary
...and see Ryan Bates' Railscast on prawn: http://railscasts.com/episodes/153-pdfs-with-prawn Grar -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe

[Rails] HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Dudebot
This is probably more of a ruby question, but I'm posting it here as HashWithIndifferentAccess is more of a rails thing. I have a @morton which is --- !map:HashWithIndifferentAccess new_lab_data_attributes: - !map:HashWithIndifferentAccess unit_id: 4 lab_desc_id: 3 value: -

[Rails] Re: How to refresh a parent page

2010-03-16 Thread Robert Walker
Sameera Gayan wrote: Hi Guys, I have the fllowing requirement, I have a model called Task to display user tasks 1 . Link to add a new task (in the tasks index page) 2 . when a user click the link, 'tasks/new' action will open up inside a popup What sort of popup? Are you opening a new

[Rails] Re: Action resource delete method is not working since upgrade to Rails 3 beta

2010-03-16 Thread John T.
Joshua Partogi wrote: Hi guys, I just upgraded my application to use Rails 3. But after the upgrade my delete/destroy method is not working anymore. Anybody experience the same thing as I do? What changes needed to be done in order to make this delete/destroy method to work again? Thank

Re: [Rails] HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Michael Pavling
On 16 March 2010 13:54, Dudebot craign...@gmail.com wrote: This is probably more of a ruby question, but I'm posting it here as HashWithIndifferentAccess is more of a rails thing. I have a @morton which is --- !map:HashWithIndifferentAccess new_lab_data_attributes: -

Re: [Rails] Recommendations for pdf generators

2010-03-16 Thread Peter De Berdt
On 16 Mar 2010, at 14:01, Michael Pavling wrote: Any recommendations for pdf generators? Prawn http://wiki.github.com/sandal/prawn/ If you can afford it, PrinceXML is awesome. Also see: http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-rails or

[Rails] Re: what is the proper role of seed data?

2010-03-16 Thread Robert Walker
Grary wrote: So, I think that my data should be accessible by administrators, but what is the Rails mechanism for that access? Am I going to be issuing raw SQL commands? Essentially, anything that can be stored in a database table can be modeled. From what I understand from your original

[Rails] db change not reflected in app

2010-03-16 Thread Jeff Ramin
Hi folks. I'm just starting to learn ruby and rails, and I'm working through a tutorial. I've hit a hurdle attempting to add a column to a table. I've created the migration file and ran it through rake, and I can see that the db (mysql) has changed. However, from what I've read, this new column

Re: [Rails] db change not reflected in app

2010-03-16 Thread Michael Pavling
On 16 March 2010 14:35, Jeff Ramin li...@ruby-forum.com wrote: However, from what I've read, this new column should immediately be reflected in the app; in other words, when I create a new widget in the app, a new form field should appear on the page. But, this isn't happening. Being

Re: [Rails] Re: Upgrading a 1.1.2 RoR App

2010-03-16 Thread Rob Biedenharn
On Mar 16, 2010, at 9:34 AM, Roch Delsalle wrote: Hi, Thanks for your answer, I'm going to try that. What do you mean by if you can vendor rails into your repository ? Is it still possible to run a 1.1.2 Rails App on Heroku or any other RoR Hosting? Regards, Roch You can freeze rails:

[Rails] Re: db change not reflected in app

2010-03-16 Thread Jeff Ramin
Michael Pavling wrote: On 16 March 2010 14:35, Jeff Ramin li...@ruby-forum.com wrote: However, from what I've read, this new column should immediately be reflected in the app; in other words, when I create a new widget in the app, a new form field should appear on the page. But, this isn't

[Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Dudebot
On Mar 16, 9:29 am, Michael Pavling pavl...@gmail.com wrote: You could try blank? (it might work):   @morton[:new_lab_data_attributes].each{ |x| x.delete if x[:value].blank? } I'm just lost with this syntax :) delete complains if it doesn't have an argument, so I tried

Re: [Rails] Re: db change not reflected in app

2010-03-16 Thread Michael Pavling
On 16 March 2010 14:55, Jeff Ramin li...@ruby-forum.com wrote: According to Agile Web Development with Rails, the field should automagically appear on views, but that was using rails 1.2 and using scaffold in the controller. I'm running rails 2.3.x, so wasn't able to use scaffold in the way

Re: [Rails] Re: db change not reflected in app

2010-03-16 Thread Hassan Schroeder
On Tue, Mar 16, 2010 at 7:55 AM, Jeff Ramin li...@ruby-forum.com wrote: According to Agile Web Development with Rails, the field should automagically appear on views, but that was using rails 1.2 and using scaffold in the controller. I'm running rails 2.3.x, so wasn't able to use scaffold in

Re: [Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Michael Pavling
On 16 March 2010 15:11, Michael Pavling pavl...@gmail.com wrote: Looks like just dropping the if would work... *sigh* no it won't... there's an extra .each iterator in there Have a play with delete_if instead of the each... -- You received this message because you are subscribed to the

Re: [Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Michael Pavling
On 16 March 2010 15:01, Dudebot craign...@gmail.com wrote: On Mar 16, 9:29 am, Michael Pavling pavl...@gmail.com wrote: You could try blank? (it might work):   @morton[:new_lab_data_attributes].each{ |x| x.delete if x[:value].blank? } I'm just lost with this syntax :)  delete complains if it

[Rails] Re: Re: db change not reflected in app

2010-03-16 Thread Jeff Ramin
Michael Pavling wrote: On 16 March 2010 14:55, Jeff Ramin li...@ruby-forum.com wrote: According to Agile Web Development with Rails, the field should automagically appear on views, but that was using rails 1.2 and using scaffold in the controller. I'm running rails 2.3.x, so wasn't able to

[Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Dudebot
On Mar 16, 10:11 am, Michael Pavling pavl...@gmail.com wrote: It was your syntax! :-) I just changed == nil to .blank? Look at the docs for Hash:http://ruby-doc.org/core/classes/Hash.html#M002870 Looks like just dropping the if would work... Oops, you were right about that (I'm so addled by

[Rails] Re: Re: db change not reflected in app

2010-03-16 Thread Jeff Ramin
Hassan Schroeder wrote: On Tue, Mar 16, 2010 at 7:55 AM, Jeff Ramin li...@ruby-forum.com wrote: According to Agile Web Development with Rails, the field should automagically appear on views, but that was using rails 1.2 and using scaffold in the controller. I'm running rails 2.3.x, so

[Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

2010-03-16 Thread Clay H.
On Mar 16, 8:33 am, Michael Pavling pavl...@gmail.com wrote: And post again if you need any more help. Hey, thanks for the help so far. I went with a method in the Medicine.rb model file and I'm trying to display the results through the view, using code similar to what you suggested. I modified

[Rails] Re: DJ: Delayed Job Noob Question

2010-03-16 Thread Michael Something
Chris Kalaboukis wrote: Hi guys: just got into Rails about a month ago and an about to launch something. I use Heroku and they limit the execution time of pages to 30 seconds. i have a process which takes a lot longer than that. So i'm trying to do a delayed job. The docs on delayed job

[Rails] Losing Decimal scale from sqlite3 to mysql going from development to staging.

2010-03-16 Thread Owain
I have been performing some testing between my development and staging environments. I had noticed that the order.amount has been truncated. All works fine in sqlite3 in development. Here is the output: Amount is meant to be decimal (8,2) to support pounds and pence (or dollars and cents).

Re: [Rails] Re: Re: db change not reflected in app

2010-03-16 Thread Hassan Schroeder
On Tue, Mar 16, 2010 at 8:19 AM, Jeff Ramin li...@ruby-forum.com wrote: Are there online tutorials you would recommend, for an experienced Java programmer who is new to ruby and rails? Coming from a similar background, I've gotten a lot out of: http://guides.rubyonrails.org/

[Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Dudebot
On Mar 16, 10:15 am, Michael Pavling pavl...@gmail.com wrote: Have a play with delete_if instead of the each... Thou art a genius! @morton[:new_lab_data_attributes].delete_if{ |x| x[ :value ].blank? } Works. *Many, many* thanks -- You received this message because you are subscribed to the

[Rails] Re: Get content from HTML element in Rails

2010-03-16 Thread Ignace S.
Anybody? If more info is needed, do ask! Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this

Re: [Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

2010-03-16 Thread Michael Pavling
On 16 March 2010 15:33, Clay H. cchea...@gmail.com wrote: On Mar 16, 8:33 am, Michael Pavling pavl...@gmail.com wrote: And post again if you need any more help. Hey, thanks for the help so far. I went with a method in the Medicine.rb model file and I'm trying to display the results through

Re: [Rails] Re: HashWithIndifferentAccess remove inner hash question

2010-03-16 Thread Michael Pavling
On 16 March 2010 15:24, Dudebot craign...@gmail.com wrote: On Mar 16, 10:15 am, Michael Pavling pavl...@gmail.com wrote: Have a play with delete_if instead of the each... Thou art a genius! @morton[:new_lab_data_attributes].delete_if{ |x| x[ :value ].blank? } It ain't me; it's the

Re: [Rails] Re: Get content from HTML element in Rails

2010-03-16 Thread Peter De Berdt
On 16 Mar 2010, at 16:44, Ignace S. wrote: Anybody? If more info is needed, do ask! Thanks More info is needed Best regards Peter De Berdt -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

Re: [Rails] more than one table per model

2010-03-16 Thread Frank Kim
Thanks everyone for all your insight. It was very helpful. I was hoping to avoid dereferencing but I guess there's no way around it. I will look into using has_one with a scheduled service for updating the secondary table. Thanks! -- You received this message because you are subscribed to

Re: [Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

2010-03-16 Thread Michael Pavling
On 16 March 2010 15:57, Michael Pavling pavl...@gmail.com wrote: Also, is it possible to order the hash so that they appear in descending order of how much of each item is in stock? In other words, sort descending by the value that the following generates? %=h #{s.last.sum(:amount_received) -

[Rails] Re: what is the proper role of seed data?

2010-03-16 Thread Grary
Robert, Another high quality response, thank you. Let me respond briefly, selectively to your reply... - The parameters x, y z will be initialized to known values. - The values of x, y z are normally fixed, but can be altered by users (administrators) at runtime. Yes, very infrequently,

Re: [Rails] Rails + Mysql

2010-03-16 Thread Leonardo Mateo
2010/3/16 José Luis Romero tangu...@gmail.com: Hi... I'm a rails newb, trying to do some rails homework or sort of... I'm trying to run rails on Fedora 12... but it seems impossible... It's impossible to install the mysql gem... Can you show the output for gem install mysql? this is the last

Re: [Rails] Get content from HTML element in Rails

2010-03-16 Thread Larry Meadors
innerHtml is not a function. innerHTML is. Larry On Tue, Mar 16, 2010 at 6:25 AM, Ignace S. li...@ruby-forum.com wrote: Hey, I'm looking for a way to get the content of my div in my Rails view. I would like the literal HTML content, so only HTML and no Rails I thought inner_html would

[Rails] SQL result to String conversion

2010-03-16 Thread Rohit Shinde
Hello All, I am very new to Ruby on Rails and I have a quick question for you all, which is as follows: I have this following line of code in an partial that renders itself on the posts/index view: Created By (User): %= User.find(:all, :select = 'name', :conditions = [id = ?, 1]) % (I am

[Rails] collection_select has_many

2010-03-16 Thread tom
hi i have two models: GeoRegion GeoRegionSub which have a has_many relation to each other. how can include the has_many relation in the collection_select helper? i want to have that dropdown where the parent is in black and the children indented. %= collection_select :dl,:parent_id,

[Rails] Re: Re: Get content from HTML element in Rails

2010-03-16 Thread Ignace S.
Peter De Berdt wrote: On 16 Mar 2010, at 16:44, Ignace S. wrote: Anybody? If more info is needed, do ask! Thanks More info is needed Best regards Peter De Berdt Little more specific? What exactly do you want to know? Larry Meadors wrote: innerHtml is not a function.

[Rails] Re: trying to install postgres gem on fedora 12 ..

2010-03-16 Thread Nominerdene Purevjav
Jedrin wrote: I get these errors : gem install pg -- --with-pgsql-include-dir='/usr/include/pgsql' -- with-pgsql-lib-dir='/usr/lib/pgsql' Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /usr/bin/ruby

[Rails] Re: validates_format_of

2010-03-16 Thread Carlos Mena
Thanks my friend whit this my :price field is correct! validates_format_of :precio, :with = /\A[0-9]{1,5}\.[0-9]{1,2}\Z/, :message = I love Rails!! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

[Rails] Re: SQL result to String conversion

2010-03-16 Thread Frederick Cheung
On Mar 16, 5:41 pm, Rohit Shinde li...@ruby-forum.com wrote: Hello All, I am very new to Ruby on Rails and I have a quick question for you all, which is as follows: I have this following line of code in an partial that renders itself on the posts/index view: Created By (User): %=

[Rails] Re: SQL result to String conversion

2010-03-16 Thread Rohit Shinde
Thanks Fred when I view d page source.. I see something like this: Created By (User): #User:0x1042bbec0 I guess this is hex representation of the memory point to the following object User id: 1, name: Ron, created_at: 2010-03-15 02:45:28, updated_at: 2010-03-15 02:45:28 Can you please

Re: [Rails] Re: SQL result to String conversion

2010-03-16 Thread Michael Pavling
On 16 March 2010 19:33, Rohit Shinde li...@ruby-forum.com wrote: Can you please advice me a way to extract just the name from there? This will give you what you want: %= User.find(:all, :select = 'name', :conditions = [id = ?, 1]).name % ...but there are so many poor and bad-practice things

[Rails] updating rails apps via REST

2010-03-16 Thread tom
hi, i have two rails-applications (similar inventory apps). they both use restful_auth. now i got the request that one app needs to be able to update a record / create a new one in the other app. so basically what i would like to know is how do i post to the other app via REST including

[Rails] Passing a block to gsub

2010-03-16 Thread Dan Paul
Hello, So I have a product description field and in that product description field every time I have the @ symbol followed by a product id the following method will replace the @ sign with the products permalink in a a href= format. The code below works. def product_description(product)

[Rails] Re: Before_filters on re-rendered methods - what is the correct RAILS way?

2010-03-16 Thread Sharagoz --
render :action = :create only renders the template for the create action, it doesnt run the actual action, thats why the before filter doesnt get called. Rendering actions and rendering templates are very similar. So simliar that Im not sure why they arent merged into one. Why are you going

Re: [Rails] Re: Recommendations for pdf generators

2010-03-16 Thread Gordon Yeong
i did before i posted. thanks On 17 March 2010 00:47, Grary grary.sti...@gmail.com wrote: ...and see Ryan Bates' Railscast on prawn: http://railscasts.com/episodes/153-pdfs-with-prawn Grar -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

[Rails] Re: Re: SQL result to String conversion

2010-03-16 Thread Rohit Shinde
Thanks a lot Michael but this (%= User.find(:all, :select = 'name', :conditions = [id = ?, 1]).name %) did not work. It gave me the following 'NoMethodError' - undefined method `name' for [#User name: Ron]:Array :-( -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Writing a large file with Spreadsheet: very slow, any HELP?

2010-03-16 Thread Joe Peck
Hey, I'm using the Spreadsheet gem to generate Excel files. It's worked great up until now. I'm trying to put 25,000 rows in a sheet, then doing book.write to write the file. It's really slow, like 3-4 minutes. Is there a way to write groups of rows to a sheet at a time, or some other way to

Re: [Rails] Re: Re: SQL result to String conversion

2010-03-16 Thread Michael Pavling
On 16 March 2010 20:28, Rohit Shinde li...@ruby-forum.com wrote: Thanks a lot Michael but this (%= User.find(:all, :select = 'name', :conditions = [id = ?, 1]).name %) did not work. It gave me the following 'NoMethodError' - undefined method `name' for [#User name: Ron]:Array Sorry...

[Rails] Error created with using script/generate command...

2010-03-16 Thread GregN
When attempting to create some Rails components using below command, I receive the following errors: [r...@localhost blog]# rake db:create (in /root/work/blog) db/development.sqlite3 already exists [r...@localhost blog]# script/generate controller home index

[Rails] Finding a Rails Programmer

2010-03-16 Thread Orlando Web Services
We are looking for an experienced rails programmer to support new clients and to assist our existing Rails developer that we use as a freelance. If you or someone you know with an established portfolio is seeking freelance opportunities, we would like to hear from you. We currently use Heroku as

[Rails] Noob stuck - complex model relationships and one of two foreign keys not getting saved or updated.

2010-03-16 Thread ander31415
Rather than posting my code and asking what's wrong, here's a simpler version: The problem is my C's are not saving or updating the foreign key for B when I create or update a C. The foreign key value remains nil. A has many Bs A has many Cs B has many Cs B belongs to A The B model

[Rails] Re: Noob stuck - complex model relationships and one of two foreign keys not getting saved or updated.

2010-03-16 Thread Frederick Cheung
On Mar 16, 5:47 pm, ander31415 ander31...@gmail.com wrote: Now, the terminal console shows the URL string contains: B_id=15, so it appears that the select function is grabbing the correct id from the table for the B choice that was selected.  However, when I then debug the updated C record,

[Rails] [JOBS] Ruby Developer needed

2010-03-16 Thread Darren Fernandes
Just wanted to send this out to anyone who is interested or knows of someone who might be. This position is with one of the nation’s premier workplaces, located in Washington, DC/Ashburn VA. We are looking for a very sharp, cross functional developer with strong Ruby and front end development

[Rails] Re: Re: Re: SQL result to String conversion

2010-03-16 Thread Rohit Shinde
That worked thanks a lot Michael :-) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group,

Re: [Rails] Error created with using script/generate command...

2010-03-16 Thread Hassan Schroeder
On Tue, Mar 16, 2010 at 10:40 AM, GregN greg_w_ne...@yahoo.com wrote: When attempting to create some Rails components using below command, I receive the following errors: [r...@localhost blog]# rake db:create (in /root/work/blog) db/development.sqlite3 already exists Not an error, it means

Re: [Rails] Re: Before_filters on re-rendered methods - what is the correct RAILS way?

2010-03-16 Thread Chris Mayan
Hello, render :action = :create only renders the template for the create action, it doesnt run the actual action, thats why the before filter doesnt get called. But if you look at the sample code, I did try to call the Create method as well as rendering its template: elsif

[Rails] Re: Noob stuck - complex model relationships and one of two foreign keys not getting saved or updated.

2010-03-16 Thread ander31415
My error (Noob!) - the model for C had set attr_protected for the B_id field. So Rails was doing exactly as I instructed it. I found this by reviewing the development log, which included a warning that B_id was protected against mass updates. Thanks all. On Mar 16, 3:13 pm, Frederick Cheung

[Rails] Re: Rails + Mysql

2010-03-16 Thread José Luis Romero
It looks like the gem is already installed, but when i run rake db:migrate I got this error of uninitialized constant MysqlCompat::MysqlRes. this is the output of gem install mysql #sudo gem install mysql --no-ri --no-rdoc Building native extensions. This could take a while... Successfully

[Rails] [ann] Rubynation DC April 9-10

2010-03-16 Thread Gray Herter
Just a note to remind everyone that the RubyNation conference is around the corner, less than one month away. We are getting close to sold out, so help us push this thing over the top! This year we have more (and better!) presentations, including a keynote presentation by the person who IMO

[Rails] Add a method for approving/disapproving content

2010-03-16 Thread David Raffauf
Hey everyone, This is my first post to the forums. I'm trying to add an 'approve' and 'disapprove' link for new content to my website. I thought I should just add two links to the show view to trigger the approve and disapprove method. Clicking these links doesn't have any effect in the DB.

[Rails] how do you manually specify the name of a submit button?

2010-03-16 Thread ct9a
hi, guys, I have an app which has two forms on the page. Both forms are based on a search model. 1) Search by keyword only (hence, only 1 element being keyword) 2) Search by a few different attributes (including keyword). Attributes are such as price, brand and make. When constructing a

Re: [Rails] Recommendations for pdf generators

2010-03-16 Thread Gordon Yeong
Looks good as i had a quick glance at the sites. Hmm PrinceXML . We'll read. keep 'em recommendations flowing in, guys and gals :) If you can afford it, PrinceXML is awesome. Also see: http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-railsor

Re: [Rails] how do you manually specify the name of a submit button?

2010-03-16 Thread Craig White
On Tue, 2010-03-16 at 20:44 -0700, ct9a wrote: hi, guys, I have an app which has two forms on the page. Both forms are based on a search model. 1) Search by keyword only (hence, only 1 element being keyword) 2) Search by a few different attributes (including keyword). Attributes are

Re: [Rails] how do you manually specify the name of a submit button?

2010-03-16 Thread Gordon Yeong
Thanks craig but my mistake, guys. I meant the id attribute. Hence, we'll get two submit buttons: input id=search_submit name=commit type=submit value=Search / (first form) input id=search_submit name=commit type=submit value=Search / (second form) On 17 March 2010 14:51, Craig White

[Rails] Re: Re: xss

2010-03-16 Thread Tom Mac
Life is much easier if you just store what they typed and deal with it when you use it... And again going through the plugin doc I found an example like class Message ActiveRecord::Base xss_terminate :except = [ :body ] end Means we can exempt some fields from sanitization. So

Re: [Rails] how do you manually specify the name of a submit button?

2010-03-16 Thread Craig White
On Wed, 2010-03-17 at 14:54 +1100, Gordon Yeong wrote: Thanks craig but my mistake, guys. I meant the id attribute. Hence, we'll get two submit buttons: input id=search_submit name=commit type=submit value=Search / (first form) input id=search_submit name=commit type=submit

Re: [Rails] Re: how do you manually specify the name of a submit button?

2010-03-16 Thread Gordon Yeong
Smart idea! thank you. I will try it out and revert. Cheers! On 17 March 2010 15:14, Loganathan Ganesan li...@ruby-forum.com wrote: Dear friend, Why can't use submit_tag in both partial and in the current form ? While using it , it won't have this id attribute. -- Posted via

[Rails] Re: how do you manually specify the name of a submit button?

2010-03-16 Thread ct9a
Problem solved. Thanks, Loganathan . W3C html validator is happy with the output generated. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this