[Rails] Re: Not really a Rails post but...

2009-06-21 Thread Marnen Laibow-Koser
timr wrote: Hi Dale, It is a good ruby question (and rails is a ruby framework--so I think it is fair game). [...] I daresay most people on this list would disagree. There are other lists and newsgroups for general Ruby questions. This is specifically a Rails list, not a general Ruby one.

[Rails] More than one criteria in business logic...

2009-06-21 Thread Alexander Trauzzi
Hello all! I'm looking to get some help answering a design problem I'm facing. I'm definitely familiar with how models house all the business logic, but when it RoR, I'm somewhat confused :) If I have Users, and they have a HABTM relationship to Messages: Users o ID o Name Messages o ID o

[Rails] Re: block pop-up for rails apps

2009-06-21 Thread Shuaib Zahda
Google adword keeps stopping my ads saying your website has popups which is against there rules On Jun 18, 10:01 am, Colin Law clan...@googlemail.com wrote: 2009/6/17 Shuaib Zahda shuaib.za...@gmail.com: Hi there It is not my ISP. Some users ISPs pops up those ads for them In that case

[Rails] Re: Display Block Conditionally

2009-06-21 Thread Tonypm
steve that's the first outline of erb I have seen. Either it doesn't get discussed a lot, or it is discussed in places I don't visit. Anyway, although I had a broad idea of what was going on under the bonnet, I had never really seen a clear example of an erb template in action. I use haml,

[Rails] Re: problems with has_many :through and habtm

2009-06-21 Thread Eric
On Jun 20, 5:18 pm, erik e...@carwoo.com wrote: I have tried this both ways and each time same results, duplicate entries. Here is the simple test: t = Trim.find(:first, :conditions = ['id 6500']) options = Option.find_all_by_trim_id(t.id) puts options.size v =

[Rails] Re: plugins still exist even though they're deleted?

2009-06-21 Thread Mike C
What do you mean? When I deleted them from my local machine I just deleted the folder (dragged into trash and emptied). On Jun 20, 10:15 pm, Phlip phlip2...@gmail.com wrote: Mike C wrote: So I deleted some plugins from my app on my local machine and pushed the changes to my git repository.

[Rails] Re: newbie need help

2009-06-21 Thread Gavin
Do you have Ruby experience? If not I'd recommend doing some basic Ruby before looking into Rails, you'll learn Rails much faster if you understand the basics of Ruby first. Check out Why's Poignant guide to ruby:

[Rails] Re: More than one criteria in business logic...

2009-06-21 Thread Gavin
Hi, why not add a named scope to messages: named_scope :public, :conditions = {:public = true} So you can call either: user.messages messages.public or user.messages.public Is that what you're looking for? Also, I think the standard for join tables is to name them in alphabetical order, so

[Rails] Re: More than one criteria in business logic...

2009-06-21 Thread Gavin
Sorry - That should have been, Message.public, not messages.public. named_scope adds a class method On Jun 21, 9:55 am, Gavin ga...@thinkersplayground.com wrote: Hi, why not add a named scope to messages: named_scope :public, :conditions = {:public = true} So you can call either:

[Rails] MySql as database in Leopard --- Will not rake

2009-06-21 Thread evandrake
I am trying to create a new application on Mac OSX Leopard with MySql instead of Sqlite3, and I am having loads of trouble. I have installed mysql and I can connect properly through mysql -u root -p. I have also installed the MySQL C bindings for Ruby through: sudo env ARCHFLAGS=-arch i386 gem

[Rails] Re: MySql as database in Leopard --- Will not rake

2009-06-21 Thread Frederick Cheung
On Jun 21, 10:23 am, evandrake evancdr...@gmail.com wrote: I am trying to create a new application on Mac OSX Leopard with MySql instead of Sqlite3, and I am having loads of trouble.  I have installed mysql and I can connect properly through mysql -u root -p. I have also installed the MySQL

[Rails] Re: plugins still exist even though they're deleted?

2009-06-21 Thread Frederick Cheung
On Jun 21, 9:44 am, Mike C snib...@gmail.com wrote: What do you mean? When I deleted them from my local machine I just deleted the folder (dragged into trash and emptied). If you did that then you didn't actually delete them from your repository. Fred On Jun 20, 10:15 pm, Phlip

[Rails] Re: plugins still exist even though they're deleted?

2009-06-21 Thread Rakoth
try git commit -a -m 'comment' --~--~-~--~~~---~--~~ 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-talk@googlegroups.com To unsubscribe from this group, send

[Rails] Run Ruby Code Stored in DB

2009-06-21 Thread Ritvvij
Hi, I have a module which needs configurable rule. This piece of code, something as small as, current_user.chapter_id, etc has been stored in the DB. I fetch this code into the helper class and then need to run it to generate an ID. How do i do it??? But of course its taking it as a string.

[Rails] Re: Run Ruby Code Stored in DB

2009-06-21 Thread Ritvvij
Is there something like REFLECTION? On Jun 21, 7:28 am, Ritvvij ritvi...@gmail.com wrote: Hi, I have a module which needs configurable rule. This piece of code, something as small as, current_user.chapter_id, etc has been stored in the DB. I fetch this code into the helper class and then

[Rails] Routing issue

2009-06-21 Thread Erwin
I have presently this in my routes.rb map.resources :media_containers , :has_many= [:media_items] as the media_items can have'libraries' and 'medias' inheritances (STI) rather than writing a route for a new media_item, with a parameter to specify the type (elibrary or not) , like :

[Rails] Re: Run Ruby Code Stored in DB

2009-06-21 Thread Frederick Cheung
On Jun 21, 1:30 pm, Ritvvij ritvi...@gmail.com wrote: Is there something like REFLECTION? Well you can use eval. However more often than not there is a better way (that won't let someone setup the rule `rm -rf` ) Fred On Jun 21, 7:28 am, Ritvvij ritvi...@gmail.com wrote: Hi, I

[Rails] Routing issue

2009-06-21 Thread Erwin
I have presently this in my routes.rb map.resources :media_containers , :has_many= [:media_items] as the media_items can have'libraries' and 'medias' inheritances (STI) rather than writing a route for a new media_item, with a parameter to specify the type (elibrary or not) , like :

[Rails] cannot do mass_assignment when inherited class ?

2009-06-21 Thread Erwin
I got the following error when trying to create the elibrary instance (rdb:21) @elibrary = Elibrary.new(params[:elibrary]) RuntimeError Exception: Declare either attr_protected or attr_accessible for Elibrary, but not both. params : elibrary={title=bingo three, short_description=something

[Rails] Re: More than one criteria in business logic...

2009-06-21 Thread Alexander Trauzzi
Gavin Morrice wrote: Hi, why not add a named scope to messages: named_scope :public, :conditions = {:public = true} So you can call either: user.messages messages.public or user.messages.public Is that what you're looking for? Also, I think the standard for join tables is to

[Rails] parsing XML POST params

2009-06-21 Thread Sarah Allen
We've just upgraded our Rails 2.0.2 app to 2.3 and the webservices create APIs are failing. Instead of receiving parsed XML, the controller's create method gets the whole xml as a hash key with the value nil. To isolate this issue, I generated a vanilla app: $ rails scaffold_xml $

[Rails] Re: parsing XML POST params

2009-06-21 Thread Sarah Allen
Sarah Allen wrote: To test my assumptions, I repeated the above steps with rails _2.0.2_ scaffold_xml_202 to look at it in the old version of rails (minus the forgery bit which didn't used to be required.) Note: in Rails 2.0.2 it does the exact same thing, so I must need to do something

[Rails] Re: parsing XML POST params

2009-06-21 Thread Frederick Cheung
On Jun 21, 3:26 pm, Sarah Allen rails-mailing-l...@andreas-s.net wrote: We've just upgraded our Rails 2.0.2 app to 2.3 and the webservices create APIs are failing.  Instead of receiving parsed XML, the controller's create method gets the whole xml as a hash key with the value nil. To

[Rails] Re: Run Ruby Code Stored in DB

2009-06-21 Thread Ritvvij
eval works! :-) Thanks you On Jun 21, 7:38 am, Frederick Cheung frederick.che...@gmail.com wrote: On Jun 21, 1:30 pm, Ritvvij ritvi...@gmail.com wrote: Is there something like REFLECTION? Well you can use eval. However more often than not there is a better way (that won't let someone

[Rails] Re: parsing XML POST params

2009-06-21 Thread Sarah Allen
Frederick Cheung wrote: I assume this is a typo and than in the real world you had remembered the closing /project. Having done that you need to get curl to set the content type appropriately. I thought that posting to projects.xml would mean that setting the content-type wasn't required

[Rails] Re: parsing XML POST params

2009-06-21 Thread Sarah Allen
Frederick Cheung wrote: I assume this is a typo and than in the real world you had remembered the closing /project. Having done that you need to get curl to set the content type appropriately. Ah, so there must be a bug in my test. This works: $ curl -X POST -d

[Rails] Re: parsing XML POST params

2009-06-21 Thread Frederick Cheung
On Jun 21, 4:05 pm, Sarah Allen rails-mailing-l...@andreas-s.net wrote: Frederick Cheung wrote: I assume this is a typo and than in the real world you had remembered the closing /project. Having done that you need to get curl to set the content type appropriately. I thought that

[Rails] Re: problems with has_many :through and habtm

2009-06-21 Thread erik
I don't follow you. I find all the options based on the idea of a trim (a style). Think about how a honda civic ex might have different options then a honda civic lx. In the real app you would only select a subset of those options to assign to your vehicle. Vehicle is kind of like an instance

[Rails] Re: problems with has_many :through and habtm

2009-06-21 Thread erik
I'm in Rails 2.2.2 if that matters. Erik On Jun 21, 8:27 am, erik e...@carwoo.com wrote: I don't follow you. I find all the options based on the idea of a trim (a style).  Think about how a honda civic ex might have different options then a honda civic lx.  In the real app you would only

[Rails] Re: newbie need help

2009-06-21 Thread juanmac
Two books: Agile Web Development with rails and Programming Ruby by The Pragmatic Programmers. Visit their site here: http://www.pragprog.com/ Those are the best book to get started Ruby and Ruby On Rails. On Jun 20, 3:04 am, rubyrailer23 rubyraile...@gmail.com wrote: Can someone help me get

[Rails] Trying to create a contact form

2009-06-21 Thread Älphä Blüë
I've been working on a contact form, however, most of the examples I see posted are outdated and I'm just having some trouble getting this to work. Here's what I've done so far: At the bottom of my environment.rb file I've placed: ActionMailer::Base.delivery_method = :smtp

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Frederick Cheung
def notifications(sent_at = Time.now) subjectparams[:subject] You're not in your controller anymore - you can't access the params hash like that. Anything you need in your mailer needs to be passed as an argument to it (although you could pass params hash itself if you wanted)

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Älphä Blüë
Well I fixed one thing: map.contact '/contact', :controller = 'contact', :action = 'index' map.send_mail '/contact', :controller = 'contact', :action = 'send_mail' .. and now I receive no errors but I also receive no mail... Still need help - thanks. -- Posted via

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Älphä Blüë
Frederick Cheung wrote: def notifications(sent_at = Time.now) subjectparams[:subject] You're not in your controller anymore - you can't access the params hash like that. Anything you need in your mailer needs to be passed as an argument to it (although you could pass params hash

[Rails] Re: newbie need help

2009-06-21 Thread Marnen Laibow-Koser
strangesthings wrote: Honestly you're going to need a book. Tutorials aren't going to go in depth enough for you to understand how rails really works. [...] Not necessarily true. Once you read Programming Ruby and get a basic idea of how Ruby works, you should be able to figure out Rails

[Rails] Re: newbie need help

2009-06-21 Thread Marnen Laibow-Koser
Gavin Morrice wrote: Do you have Ruby experience? If not I'd recommend doing some basic Ruby before looking into Rails, you'll learn Rails much faster if you understand the basics of Ruby first. Absolutely! Check out Why's Poignant guide to ruby: [long URL snipped] Direct URL is

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Älphä Blüë
Controller = def send_mail @name = params[:name] @subject = params[:subject] @body = params[:body] @address = params[:address] Mailer.deliver_notifications(params[:email]) flash[:notice] = Email was succesfully sent. redirect_to :action = index end

[Rails] Re: Run Ruby Code Stored in DB

2009-06-21 Thread Marnen Laibow-Koser
Ritvvij wrote: eval works! :-) Thanks you It may work, but you *must* safeguard it so a malicious user doesn't make you eval User.delete_all! Be careful! Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/.

[Rails] Re: problems with has_many :through and habtm

2009-06-21 Thread Eric
What are the associations for the Trim model, wrt Options and Vehicles? I'm also assuming that the NewVehicle model is a typo and it's supposed to be just Vehicle.new in the snippet. I'm thinking that you need either uniqueness validations or to dedupe manually in your save/updates, but it's

[Rails] Re: Display Block Conditionally

2009-06-21 Thread Marnen Laibow-Koser
Tonypm wrote: steve that's the first outline of erb I have seen. Yes, thanks for that. I know intuitively how ERb works, but had never looked at the internals in any detail. [...] I use haml, and I have often wondered how it hooks into erb. As far as I know, it doesn't (unless you

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Frederick Cheung
On 21 Jun 2009, at 17:24, Älphä Blüë rails-mailing-l...@andreas- s.net wrote: Controller = def send_mail @name = params[:name] @subject = params[:subject] @body = params[:body] @address = params[:address] The controller and the mailer are different objects - you can't

[Rails] Re: respond_to and ActionController::InvalidAuthenticityToke

2009-06-21 Thread Leon Berenschot
I added (rails 2.3.2) %= javascript_tag window._token = '#{form_authenticity_token}' % which solved my problem. see http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html for more info -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Display Block Conditionally

2009-06-21 Thread s.ross
On Jun 21, 2009, at 9:48 AM, Marnen Laibow-Koser rails-mailing-l...@andreas-s.net wrote: Tonypm wrote: steve that's the first outline of erb I have seen. Glad to be of help. Yes, thanks for that. I know intuitively how ERb works, but had never looked at the internals in any

[Rails] Capistrano and the task `cleanup' does not exist

2009-06-21 Thread nickflux
I use Capistrano for deploying my apps, and have been doing so for a while. I keep seeing references to the 'cleanup' task, as in: desc Cleanup after every deployment task :after_deploy do cleanup end But I don't seem to have this task available. It doesn't show up when I run cap -T. Anyone

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Mat Harvard
You can set up instance variables in your mailer model accessible inside the view like this: # allows access to @message and @sender_name :message = email_params[:body], :sender_name = email_params[:name] On 21-Jun-09, at 9:18 AM, Älphä Blüë wrote: Frederick Cheung wrote: def

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Älphä Blüë
I'm sorry if I'm newbish on this subject and some things I understand and others I don't. I believe I have this very close to being correct: My Mailer modle is mailer.rb class Mailer ActionMailer::Base def notifications(email_params, sent_at = Time.now) subject

[Rails] Re: parsing XML POST params

2009-06-21 Thread Sarah Allen
Thanks for your help, Fred. For future reference, I've written up a little cheat sheet with the various curl commands to access the various default Rails XML APIs: http://www.ultrasaurus.com/sarahblog/2009/06/simple-web-services-with-rails/ -- Posted via http://www.ruby-forum.com/.

[Rails] Re: MySql as database in Leopard --- Will not rake

2009-06-21 Thread evandrake
I tried downloading the 32bit version, because I know that the 64bit version has issues with Leopard. However, I am worried there might still be some remnants of a previous install on my computer. How can I check the version and ensure all of the 64bit files are deleted? On Jun 21, 3:16 am,

[Rails] Re: plugins still exist even though they're deleted?

2009-06-21 Thread Mike C
Thanks, that seems to have done the trick since but I'll test again to make sure. What does that -a option do? On Jun 21, 4:48 am, Rakoth rakot...@gmail.com wrote: try git commit -a -m 'comment' --~--~-~--~~~---~--~~ You received this message because you are

[Rails] Re: redirect_back_or_default not work properly

2009-06-21 Thread Hemali Chauhan
Share the solution if you dont mind On Thu, Jun 18, 2009 at 8:17 PM, daociyiyou chey...@yahoo.com.cn wrote: Have resolved this problem. -- Hemali Chauhan Complitech Solutions (www.complitech.net) --~--~-~--~~~---~--~~ You received this message because you

[Rails] Re: Capistrano and the task `cleanup' does not exist

2009-06-21 Thread Marnen Laibow-Koser
nickflux wrote: I use Capistrano for deploying my apps, and have been doing so for a while. I keep seeing references to the 'cleanup' task, as in: desc Cleanup after every deployment task :after_deploy do cleanup end But I don't seem to have this task available. [...] Assumning a

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Frederick Cheung
On Jun 21, 7:03 pm, Älphä Blüë rails-mailing-l...@andreas-s.net wrote: Again, I get no errors of any sort but no mail is received.  If you see something that I'm doing wrong, if you could provide a small code snippet for correction, I will understand your explanation better. At this point

[Rails] Re: Trying to create a contact form

2009-06-21 Thread Älphä Blüë
Thanks for the input Fred. I actually removed that - it was being potentially used for something else down the road, so it really didn't apply here. I've decided to take an entirely different approach with the contact form at this point. I believe the easier way to implement it, and even

[Rails] Re: problems with has_many :through and habtm

2009-06-21 Thread erik
NewVehicle is STI off of Vehicle. It doesn't matter if you use Vehicle or NewVehicle the outcome is the same. Trim definition: class Trim ActiveRecord::Base ## Associations belongs_to :model has_many:colors has_many:options so it has_many options, which is why t.options would of

[Rails] Re: Active resource record relationships

2009-06-21 Thread Rick
Right. You might want to look at Chap 15 in The Rails Way, Obie Fernandez et.al., 2008. It covers XML and ActiveResource - only 27 pages but the best I've been able to find to date. I'm assuming that what you mean by complex relationships is the A...Resource parallel to associations in

[Rails] Re: Capistrano and the task `cleanup' does not exist

2009-06-21 Thread nickflux
Thanks. That's worked a treat. Nick On Jun 21, 3:58 pm, Marnen Laibow-Koser rails-mailing-l...@andreas- s.net wrote: nickflux wrote: I use Capistrano for deploying my apps, and have been doing so for a while. I keep seeing references to the 'cleanup' task, as in: desc Cleanup after

[Rails] Re: FasterCVS and Rails

2009-06-21 Thread Hu Ma
Hello all, I've update to Rails 2.3.2 and the problem remains. I've also created a new application, and added just one controller and FasterCSV to environment.rb (no other plugins are present in the application) but still it does not work. I already said here that the error only happens in

[Rails] how params (without @) works?

2009-06-21 Thread Xiahong Gao
I am newb. I feel confused about how params works. I understand @params is an attribute of CLASS, but what is params? A named parameter? Because I thought instance attributes always begin with @”, so params/request/flash/etc looks like a local variable. thanks in advance Xiahong

[Rails] Re: how params (without @) works?

2009-06-21 Thread pharrington
On Jun 21, 8:04 pm, Xiahong Gao gaox...@gmail.com wrote: I am newb. I feel confused about how params works. I understand @params is an attribute of CLASS, but what is params? A named parameter? Because I thought instance attributes always begin with @”, so params/request/flash/etc looks

[Rails] How can I contribute with http://api.rubyonrails.org/ ?

2009-06-21 Thread Eric Fer
Hi everyone. I was looking for a helper definition (create_table) and I've noticed that the documentation in http://api.rubyonrails.org/ is incomplete. It's not covering the sexy migration options to defining the columns like t.string :name. It's just showing t.column :name, :string way. There

[Rails] Re: How can I contribute with http://api.rubyonrails.org/ ?

2009-06-21 Thread pharrington
On Jun 21, 9:12 pm, Eric Fer eric@gmail.com wrote: Hi everyone. I was looking for a helper definition (create_table) and I've noticed that the documentation inhttp://api.rubyonrails.org/is incomplete. It's not covering the sexy migration options to defining the columns like t.string

[Rails] Re: How can I contribute with http://api.rubyonrails.org/ ?

2009-06-21 Thread pharrington
On Jun 21, 9:12 pm, Eric Fer eric@gmail.com wrote: Hi everyone. I was looking for a helper definition (create_table) and I've noticed that the documentation inhttp://api.rubyonrails.org/is incomplete. It's not covering the sexy migration options to defining the columns like t.string

[Rails] Re: how params (without @) works?

2009-06-21 Thread gaoxh gaoxh04
flash is the instance method of class ActionController::Flash. but our application controller is inherited from ActionController::Base, why can we use flash in our application controller ? to be more concrete, i guess the code has the following form: Class ActionController{ Class Flash

[Rails] Re: respond_to issue in IE7

2009-06-21 Thread Shanmu Gam
Matt Jones wrote: This is a known issue with IE sending an incorrect Accepts: header. See also this: http://www.danielcadenas.com/2008/10/internet-explorer-7-accept-header-and.html --Matt Jones On Jun 19, 10:20�am, Shanmu Gam rails-mailing-l...@andreas-s.net Thanks Jones, -- Posted