[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 it

[Rails] Re: distinctively difficult to do what I want

2012-04-03 Thread bingo bob
drat another road block... So now I wish to create Names and I can't fiond the secret sauce. my old create action was simply a variation on the normal..something like this.. def create @name = Name.new(params[:name]) respond_to do |format| if @name.save else end end end How

[Rails] Re: distinctively difficult to do what I want

2012-04-01 Thread bingo bob
Looking after the children but I think you got it - thanks :-) two changes... model filename from user_names.rb to user_name.rb and as you say class UserName < ActiveRecord::Base gives... ruby-1.9.2-p290 :005 > User.last.names User Load (0.8ms) SELECT "users".* FROM "users" ORDER BY "users

[Rails] Re: Re: distinctively difficult to do what I want

2012-04-01 Thread bingo bob
Colin Law wrote in post #1054363: > On 29 March 2012 17:17, bingo bob wrote: >> >> devise :database_authenticatable, :registerable, >> NameError: uninitialized constant User::UserName > What is that ORDER BY lower(username) doing? I don't see where that > is co

[Rails] Re: distinctively difficult to do what I want

2012-03-30 Thread bingo bob
can anyone shed any light on this... two questions. 1) do the new relationships via the join table look wrong (hence the console error) 2) does my data_mover script look OK? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups

[Rails] Re: distinctively difficult to do what I want

2012-03-29 Thread bingo bob
Schema attached.. model summaries... class Name < ActiveRecord::Base attr_accessible :given, :gender, :position has_many :user_names has_many :users, :through => :user_names class UserNames < ActiveRecord::Base belongs_to :user belongs_to :name class User < ActiveRecord::Base #

[Rails] Re: Re: Re: Re: distinctively difficult to do what I want

2012-03-29 Thread bingo bob
Thanks Colin, I'm giving this a go but running into problems. Is there a problem perhaps with using the join table name of UsersNames or UserNames as it might clash with the User.username attribute. I'll post my code later - just wondering does the name of the join table matter at all ? I wro

[Rails] Re: Re: Re: distinctively difficult to do what I want

2012-03-26 Thread bingo bob
Colin Law wrote in post #1052973: > On 23 March 2012 16:48, bingo bob wrote: >> >>>> Freddy (2, male) >>> >>> What if one of the Freddys is female? Maybe not likely with this name >>> but there are names that can be both. >> >> True - i

[Rails] Re: Re: distinctively difficult to do what I want

2012-03-23 Thread bingo bob
Colin Law wrote in post #1052938: > On 23 March 2012 09:24, bingo bob wrote: >> "owned" by different users who may have it as a different position in >> Freddy >> Rod (3, male) > A couple of questions > Are all the Rod records identical except for which user

[Rails] Re: distinctively difficult to do what I want

2012-03-23 Thread bingo bob
OK Thanks - I've had another think about it but I'd still appreciate any insight if possible. I had wondered if my data model is wrong but I don't think so, it's rather simple. Users have names and Names belong to users. It has to be like this as Users can individually sort their names (so the

[Rails] Re: guilty by association

2012-03-22 Thread bingo bob
Thanks Kisha - the links are useful, I was aware of them both by despite having a crack at this in the console (I find that's a great place to try stuff out and experiment I can't get there). Here's another way of looking at it, the output/result I need. Given the schema above I need the result

[Rails] guilty by association

2012-03-20 Thread bingo bob
No apologies for the punny title! Anyway, here's the thing. I know what I want to do but not sure of the right way to model it. So far I have this in place. User has_many :names User.username User.email Name belongs_to :user Name.given Name.gender Name.user_id So basically a User has a lis

[Rails] Re: distinctively difficult to do what I want

2012-03-16 Thread bingo bob
> If I understand correctly, then in the case where there are several > records with given == "fred" for example, then you want to get a Name > object back so you can access the other attributes. But how will the > code know which of the records with given == "fred" that you want? > The other attr

[Rails] distinctively difficult to do what I want

2012-03-16 Thread bingo bob
I'm going around in circles with this one can't solve it. I have a database with a lot of Name objects in it, some have the same given name - ok fairly normal. Name given (string) gender (string) # it's either m or f, not really relevant position (integer) # not really relevant user_id (i

[Rails] Re: listmania - anaylsing multiple lists in a method

2012-01-14 Thread bingo bob
How do I setup the habtm relationships I need an additional table right? -- 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-talk@googlegroups.com. T

[Rails] Re: Re: listmania - anaylsing multiple lists in a method

2012-01-14 Thread bingo bob
Dave Aronson wrote in post #1040718: > On Fri, Jan 13, 2012 at 07:21, bingo bob wrote: > >> User has_many names >> Name belongs_to User > > So the two 'harry's in your list are two different objects? Is that a > necessary part of your model? > > -Dave

[Rails] Re: listmania - anaylsing multiple lists in a method

2012-01-13 Thread bingo bob
Is my proposed method (while probably not the most elegant) a reasonable way of attacking the problem? -- 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 rubyo

[Rails] Re: listmania - anaylsing multiple lists in a method

2012-01-13 Thread bingo bob
Hi Colin, Sorry - just seen your question as I was writing my method above... User has_many names Name belongs_to User -- 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, se

[Rails] Re: listmania - anaylsing multiple lists in a method

2012-01-13 Thread bingo bob
Actually, I'll try for the instance method for the male version in name.rb.. def find_similar_male # get all users users = User.all # get all male names names = Name.male # get the similar names similar_names = [] # loop users... users.each do |user| # loop names user.nam

[Rails] Re: listmania - anaylsing multiple lists in a method

2012-01-13 Thread bingo bob
Actually - thinking it through this is an instance method I believe, acts on an instance of a name. Kind of talking out loud here. -- 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 thi

[Rails] listmania - anaylsing multiple lists in a method

2012-01-13 Thread bingo bob
Hoping someone might be able to throw me a few clues on this one. I'm working with lists of names a User (current_user) manages lists of names, some male some female (scoped on m or f in gender), it's all set up such that I can do things like this - all working out fine. current_user.names.male (

[Rails] Re: Constructing an array of stuff (to send multiple apple push notifications)

2011-05-12 Thread bingo bob
Thanks Colin, I'll give that a spin. The example code in the gem does seem odd. -- 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-talk@googlegroup

[Rails] Re: Constructing an array of stuff (to send multiple apple push notifications)

2011-05-11 Thread bingo bob
Any ideas? -- 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk

[Rails] Constructing an array of stuff (to send multiple apple push notifications)

2011-05-11 Thread bingo bob
I'm using this gem https://github.com/justintv/APNS to send push notifications to an iPhone app and amazingly it works for single notifications, such that I can do... APNS.send_notification(Device.first.device_token,'test message') Works great... Now it should be a simple task (as per the docs t

[Rails] Re: Splitting up a long running task with delayed job

2011-03-24 Thread bingo bob
anyone done anything like this before? -- 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-talk@googlegroups.com. To unsubscribe from this group, sen

[Rails] Splitting up a long running task with delayed job

2011-03-22 Thread bingo bob
I have a method on my model that looks like this. def self.itunes_update # don't run it if it's already running if Setting.first.update_lock? puts "updates locked" # it's not running right now so run it else all_apps = self.all all_apps.each do |app| # do stuff with each

[Rails] Re: Bypassing ORM for performance, is it worth it ?

2011-02-16 Thread bingo bob
Thanks for yours, I hear your ideas. I'm not hearing anything massive that I haven't done or need to change. I think I'll stay where I am for now and see how I go - updated_at column is indexed. Thanks for the tips re the JSON, I had done a tweak on that in the model already by overriding the

[Rails] Bypassing ORM for performance, is it worth it ?

2011-02-15 Thread bingo bob
The following method in my rails app is called very, very frequently on incoming requests and results in model objects being rendered as JSON. All is working fine, but this thing has to be as efficient and fast as possible. So far I've added an index to updated_at and I've enabled mod_deflate on th

[Rails] Re: production and development - differing behaviour

2011-01-29 Thread bingo bob
Is this to do with the T and Z delimiters not being recognised by mysql? -- 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-talk@googlegroups.com. T

[Rails] Re: production and development - differing behaviour

2011-01-29 Thread bingo bob
Or to put it another way, what's the best/correct way to specify DATETIMEs in a URL. -- 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-talk@google

[Rails] Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
Logging now on in production for a while. so that helps. When the URL is crafted this way it works...(I thought I'd cracked it) IP/apps.json?date_from=2011-01-28%2013:58:38&date_to=2011-01-28%2013:58:38 log Parameters: {"date_to"=>"2011-01-28 13:58:38", "date_from"=>"2011-01-28 13:58:38"}

[Rails] Re: Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
I thought that's how you had to format dates in a URL to have them recognised by rails. I'll try it the same as on the console then. -- 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

[Rails] Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
Ok, that makes sense, but how do I see the SQL generated in production. It's logged by default in dev, but not in prod AFAIK. -- 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 gro

[Rails] Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
OK, tested... on my server, in production, ./script/console >> App.time_query("2011-01-28 13:58:38","2011-01-28 13:58:38") => [#> so it works... returns a single app as I might expect in the browser I do... http://server_ip/apps.json?date_from=2011-01-28T13:58:38Z&date_to=2011-01-28T13:58:38

[Rails] Re: Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
Peter Hickman wrote in post #978144: > Do you have the same database on the two machines (ie both running > MySQL or something). Yes - same DB on both machines, mysql. > As this is a method in a model have you checked it from the console in > production mode on the production server? If it doesn'

[Rails] Re: production and development - differing behaviour

2011-01-28 Thread bingo bob
Same thing - it works on my MacBook in prod mode with the production data loaded. Not on my server though. -- 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 r

[Rails] production and development - differing behaviour

2011-01-28 Thread bingo bob
I'll elaborate with code and URLs if it helps but I'll start just describing the problem and seeing if anyone can help me out with some ideas. I have a method which returns some objects as json via a time_query method on my model - the time query takes a couple of parameters date_from and date_to.

[Rails] Re: Updating an attribute from a POST request

2011-01-09 Thread bingo bob
Also, slight aside but can I simulate the action of the iOS app submitting the URL with a curl command on my mac or similar. For testing. -- 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 pos

[Rails] Re: Updating an attribute from a POST request

2011-01-09 Thread bingo bob
Update to this. Transpires that we'd like to use the apple_identifier in the URL to do the update rather than the more standard rails db App.id. So the URL submitted to do the update could look more like this. POST to http://server.com/apps?apple_identifier=6383940&incremental_update=1 Whe

[Rails] Updating an attribute from a POST request

2011-01-09 Thread bingo bob
Hi all, I'd like to update an attribute in a model via an external POST request. The external request is coming from an iOS iPhone application but I imagine this is not relevant. If I have a model App and it has the following attributes... App apple_identifier :integer popularity :integer

[Rails] Re: vestal versions

2011-01-02 Thread bingo bob
> If what you want to do is store a set of values for something varying > over time and wish to query the set, pick out max and min and so on > then I suggest this is not best served by versioning. Instead model > it in the normal way. So App has_many price_tiers, PriceTier > belongs_to app, and

[Rails] vestal versions

2010-12-27 Thread bingo bob
Thanks Walter, very clear and useful, it looks right for me - but two things. 1) Why does it create the user stuff in the vv migration/model - I dont have users in this app, should I delete those attributes or just not worry about them, and it'll just work (tm). 2) It seems to be more aimed at

[Rails] Re: How to test the layout of a controller?

2010-12-27 Thread bingo bob
Can I chip in here as a slight aside - after Marnen (or someone else on here) "tore a strip off me" after I asked about cucumber without really doing the groundwork myself I went off and tried it in my app (sorry about the initial lack of effort and thanks for the kick up the arse). Anyway to c

[Rails] Re: associations / json and doing things right

2010-12-27 Thread bingo bob
Have started to look at vestal versions...appears that it might be just the ticket, thanks for the idea. To use it, I imagine I have to specify any attributes I wish to version in the migration file generated by the vestal versions generate script - that right ? Not sure it's what I want thoug

[Rails] git deployment - more simple than capistrano

2010-12-27 Thread bingo bob
Hi, Previously I've deployed on my server (apache / passenger) with simply git clone foo, and then pull in version updates with git pull. While I read lots re staging servers and capistrano it works pretty well for me. Anyone else do it my way? Don't really have time for learning capistrano right

[Rails] Re: Question re Non Standard ID and Restful routes.

2010-12-22 Thread bingo bob
You said.. > Then in your controller, you just need to do > "App.find_by_application_id(params[:id])" did you mean. "App.find_by_application_id(params[:application_id])" -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ru

[Rails] Question re Non Standard ID and Restful routes.

2010-12-22 Thread bingo bob
I'd like to do this.. map.resources :app, :primary_key => [:application_id] application_id is an apple app id. There are no relationships involved. I thought it'd be good to do this in future /show/:application_id as well as / instead of /show/:id Thing is though, a few questions... 1) wi

[Rails] Re: associations / json and doing things right

2010-12-21 Thread bingo bob
> Or are you saying that App has both a tier_id and a tier_code ? If so, > then you're right; that's terrible. oops - yes, that's what I'd doing at the moment - and I'd like to change that I realise it's terrible. The question I have is if I remove the tier_code then how do I serve up json from

[Rails] associations / json and doing things right

2010-12-21 Thread bingo bob
I'm doing stuff with Apps in the App Store. Apps belong to a price tier. Such that. App belongs_to :tier Tier has_many :apps All good so far. I want to monitor when an app changes tier amongst other thing, don't need a history, but need to record the previous tier. My plan was to store att

[Rails] Processing a file of structured data of unknown origin

2010-12-04 Thread bingo bob
I have a file with data structured in this way... http://pastie.org/1347044 So basically it's Country Region Resort url url url url Resort url url Country Region Resort url Resort url url etc, the data is clearly struct

[Rails] Re: Rails testing question

2010-11-09 Thread bingo bob
Bit of a hijack on this thread but I've got an app in production with currently no test coverage (yes, I know). I've dabbled with the rails in built tests in the past and totally understand why one should have test coverage, even if I don't do BDD. Anyway, I'm hearing that cucumber is what what

[Rails] Re: non event_calendar

2010-11-05 Thread bingo bob
Ignore me. I needed a helper like this.. All good - :-), it looks Great. module CalendarHelper def month_link(month_date) link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year}) end # custom options for this calendar def event_cale

[Rails] Re: non event_calendar

2010-11-05 Thread bingo bob
Hmm, thinking out load here - I just created a fresh test app with just the plugin and it worked. dates are all of type DATETIME. My dates of of type DATE - maybe that's the problem. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Goog

[Rails] Re: non event_calendar

2010-11-05 Thread bingo bob
Interestingly if I change this... class Booking < ActiveRecord::Base has_event_calendar :start_at_field => 'arrival_date', :end_at_field => 'departure_date' to simply has_event_calendar I get this error... Mysql::Error: Unknown column 'end_at' in 'where clause': SELECT * FROM `bookings` W

[Rails] non event_calendar

2010-11-05 Thread bingo bob
What am I missing here, trying to get the event_calendar plugin working with my existing app. Have installed the plugin, which I guess is a good start, then this... class Booking < ActiveRecord::Base has_event_calendar :start_at_field => 'arrival_date', :end_at_field => 'departure_date' Route..

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-26 Thread bingo bob
Am I on the right lines ? -- 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, send email to r

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-26 Thread bingo bob
Inline - I won't have a chance to test this out until a little later but yes - thanks for this, think I'm getting it. Owain wrote in post #957124: > A quick look and the following points: > > - you are not scoping your property_id to the domain. If you go to > http://chaletcordee.co.uk/propertie

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-26 Thread bingo bob
Multiple apps is definitely not what I wish to do here. It's a single app. -- 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.

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-25 Thread bingo bob
Now I'm firmly back in the rails world here, any kind soul give me a pointer as to how I might finish this one. I figure I need to modify the routes file and perhaps conditionally modify the rails app home root based on domain - what else? -- Posted via http://www.ruby-forum.com/. -- You rec

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-25 Thread bingo bob
or to put it another way... what does your routes.rb look like to get the root urls right for a property (in my case properties anyway). also, totally happy to bypass properties controller for the public views, just figured I'd done it the rails way with a properties controller and separate act

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-25 Thread bingo bob
Right - once more unto the breach and all that! Thanks for this, I see what you mean. I've part implemented, the bit I don't quite get relates to finding the relevant property and what I put in the routes file to hook it up (hooking up the default root to a domain/property). The bit you describ

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-25 Thread bingo bob
any tips - I'm not certain that I can achieve this with modrewrite. -- 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 uns

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-23 Thread bingo bob
Been trying rewrite stuff all week but can't get to where I want to be. If anyone has an answer or another way - v keen to hear. I did wonder about this...http://github.com/shuber/proxy or my routes.rb file - or more apache tinkering.. this didn't get me there either (lots of repeated stuff here

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-20 Thread bingo bob
Luis Saffie wrote in post #955491: > Did you try using the flags Walter suggested, [NS,QSA]? Can you post > your Apache rewrite rules? > > Hopefully we're not going too off topic with Apache :-) Sorry for delay, currently running with this ServerName chaletcordee.co.uk ServerAlias www.chal

[Rails] Re: Re: something is removing my whitespace

2010-10-20 Thread bingo bob
Thanks Philip - sounds to me that you have some experience in isolating and eradicating gremlins of this kind. I'll try this approach and report back. In the meantime if it's helpful to anyone I'm wroking around the problem with my beta users by simply asking them to use foo, which works just

[Rails] Re: Re: multiple domain names mapping to different rails app URLs

2010-10-19 Thread bingo bob
Could well be overcomplicating things! Walter's point here is sounds closest I think - I'll try it. > You can do redirects that fundamentally rewrite the URL from the > server's perspective, without changing what the user sees in their > browser's location bar. So you could avoid the whole routes

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-19 Thread bingo bob
Well in my case I need to do two things. 1) redirect www.foo.com => www.foo.com/properties/1/ DONE 2) rewrite the resulting url www.foo.com/properties/1/ => www.foo.com NOT DONE YET I'm clear point 1 should be done in Apache config, as it is. Are you saying point (2) should be done in Apache or

[Rails] Re: something is removing my whitespace

2010-10-19 Thread bingo bob
Anyone have any further insight on this one - it's still not solved for me, should I look perhaps at altering my database configuration or perhaps it's something in the migration that sets up these attributes? No clue but something means I cannot save a text type attribute to the db that begins

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-19 Thread bingo bob
Thanks Luis, I'll refer to them and see if I can find a solution totally via apache/modrewrite; I suspect I can! I need to get a handle on the syntax of those rewrite commands, the command chain and regexes, should be ok. I'll post back to this thread with the solution when I crack it. You need to

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
Anyone else comment as to if this combination of apache rewrites and rails routing will play nicely together. I'll try it of course just imagine that it may have been done before by somebody. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
I'm half way there then? Need to handle the rest on the rails side - via my routes.rb file? Will this approach work? -- 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

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
So taking it a step on I figure I need to work on a few things... need to make sure www versions all operate ok. need to make sure that when I add another domain, that works to. http://chaletcordee.co.uk/properties/1/comments should be http://chaletcordee.co.uk/comments guess this is the rails

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
Thanks for bearing with me. That one didn't work - close but it gave me a double rendering of the apartment-marie.com bit, something like this... apartment-marie.com/apartment-marie.com/properties bla... so I edited like so (here's the real file and it's live if it helps).. This is much better

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
totally lost. -- 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, send email to rubyonrails-t

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
Hi Luis, Thanks for this, I'm getting *really* close I think. That looks fine and I've tried - the redirects are taking effect but it's not quite right. The localhost:3000 part was just on my Mac, now I'm on the server I need to replace that in some way with the root of the rails app - how do

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
Someone's suggested that actually using virtual hosts maybe a better way for me to do this? Thoughts? -- 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 rubyon

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-18 Thread bingo bob
Thanks for this. I'm about to try and implement it, appreciate this is a little OT, but has anyone got any more tips for me or even a quick example. Just to be clear, I'm using passenger - will that get in the way or also need any configuration? -- Posted via http://www.ruby-forum.com/. --

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-16 Thread bingo bob
Luis Saffie wrote in post #954771: > You could do this with Apache > Look at modrewrite > > Luis Thanks that's great. Will it have the flexibility to deal with all the sub pages? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Gr

[Rails] Re: multiple domain names mapping to different rails app URLs

2010-10-16 Thread bingo bob
Anyone done anything like this before? -- 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, sen

[Rails] multiple domain names mapping to different rails app URLs

2010-10-15 Thread bingo bob
OK, I'm really confused as to how this might work/if it's possible or even if I'm thinking about it right, so I'll just explain what I'd like to do and you can shoot holes in it. I have an app running that is for properties. Each property has it's own "website" within my app and a user can tweak t

[Rails] Re: protecting resources in an app

2010-10-10 Thread bingo bob
Heinz Strunk wrote: > I'm doing it just like you described above. However I would like to hear > some more opinions on that as well. That's really good to know - a slight twist on it could be that I have seen people DRY it up and include more sophistication on the find by using a before filter

[Rails] Re: protecting resources in an app

2010-10-10 Thread bingo bob
Anybody? Are there further steps required? -- 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,

[Rails] protecting resources in an app

2010-10-10 Thread bingo bob
hi chaps. just want to check that i'm on the right lines with protecting resources in an app, the idea that only the resources owner can do stuff to it I figure there are only two steps I need (with authlogic), but I may be missing stuff 1st is a check authorised before filter, which just checks th

[Rails] Re: i18n not working by default

2010-10-07 Thread bingo bob
> Use I18n.l (short for I18n.localize, also available as just l in > views) > > Fred Aha, that explains it - so it is intended behaviour! Thanks *again* for such a quick and clear and helpful response Fred. :-). bb. -- Posted via http://www.ruby-forum.com/. -- You received this message becaus

[Rails] i18n not working by default

2010-10-07 Thread bingo bob
I'm try this groovy i18n stuff for formatting my dates in UK format. Console tests seem to show me I have it configured properly but I'm not 100%. How do I set up the app so that in a view when I do <%= Person.first.birthday %> it shows in UK format as specified in my i18 config file. Currently

[Rails] Re: Re: something is removing my whitespace

2010-10-06 Thread bingo bob
Just to confirm, Walter's interpretation of what I'm seeing is absolutely right. The lack of the newline at the start is significant as it means the first heading doesn't get rendered as HTML it just gets put out as "h2. foo", which is, well, rubbish - my investigations continue. Something funk

[Rails] Re: something is removing my whitespace

2010-10-06 Thread bingo bob
The more I think about this the more Fred's suggestion makes sense - I suspect that mysql is somehow monkeying with the text on save, trimming it at the top or removing CR characters or the like. Is this normal? How can you control this behaviour, seems wierd that it does this by default if thi

[Rails] Re: something is removing my whitespace

2010-10-06 Thread bingo bob
> mysql will trim trailing whitespace from varchar columns, although it > sounds like you are talking about leading whitespace. Interesting, thanks, hmmm, well it is mysql, yes and yes it's leading whitespace but the column type here (in my migration) is either "text" or "string", can't remember

[Rails] jquery not working in production

2010-10-06 Thread bingo bob
Rather odd this, in dev on my mac my jquery calendarpicker works fine. Same code (I think and checked!) in production and jquery doesn't activate - any ideas or major gotchas? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups

[Rails] Re: Re: something is removing my whitespace

2010-10-06 Thread bingo bob
No JS on the text areas, maybe it's something to do with the DB type? Could it be formtastic doing this ? hmm. thanks will rebuid the form without formtastic and test if it comes to that - any other ideas, something in the update action of the controller striping stuff out? It's a standard scaf

[Rails] Re: something is removing my whitespace

2010-10-05 Thread bingo bob
Any ideas - something is killing the CR or newline characters ? -- 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 unsubsc

[Rails] something is removing my whitespace

2010-10-05 Thread bingo bob
Sorry for lack of a code example but I think in this case I cna just explain the issue and a lightbulb might go off with someone as to what is happening. I needed to allow my users to construct a nicely formatted piece of text that I'd render as HTML without having them to learn HTML. Didn't need

[Rails] safariwatir - clicking a dialog box

2010-08-17 Thread bingo bob
Not hopeful that anyone else is doing this but I thought I'd try. safariwatir is a pretty fun way to test an app by remote controlling the browser. Seems to work well. Useful. One thing though (and I think this horse has been flogged before but I can't find an answer). In "safariwatir" specfically

[Rails] names and stuff

2010-08-11 Thread bingo bob
I'm trying to stuff like this in my BabyName model.. before_save :capitalize def capitalize self.title= title.capitalize self.forename = forename.capitalize self.surname = surname.capitalize self.middlenames = middlenames.split.each { |x| print x.capitalize!,

[Rails] Re: Re: Re: Re: Re: Re: authlogic and controllers - plus general advice

2010-08-08 Thread bingo bob
> I was thinking more along the lines of > @baby_names = BabyName.find( :all, :conditions => { user_id => > current_user.id } ) > to get all of them, or > > @baby_name = BabyName.find(params[:id], :conditions => { user_id => > current_user.id }) if params[:id] Hi all, I actually couldn't get this

[Rails] Re: Re: Re: Re: Re: authlogic and controllers - plus general advice

2010-08-06 Thread bingo bob
and i think it's lambda - not that i know what that is - will found out, seen them mentioned, Llama anyone. :-) -- 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

[Rails] Re: Re: Re: Re: Re: authlogic and controllers - plus general advice

2010-08-06 Thread bingo bob
Understood, thanks for taking the time to explain this in such detail. I'll start by making sure my find conditions in the existing controller are correct and limited to current_user, after that I'll look at moving them to the model - and sorry yes, I appreciate I'll call them from the controll

[Rails] Re: Re: Re: Re: authlogic and controllers - plus general advice

2010-08-06 Thread bingo bob
> You can't do the finds in a filter because what you want to do depends > on the action (find all for index but only one for edit for example). ok, understood - and that might sound obvious but it wasn't, I had visions of doing something programtically in the before filter to check what action

[Rails] Re: Re: Re: authlogic and controllers - plus general advice

2010-08-06 Thread bingo bob
> I was thinking more along the lines of > @baby_names = BabyName.find( :all, :conditions => { user_id => > current_user.id } ) > to get all of them, or > > @baby_name = BabyName.find(params[:id], :conditions => { user_id => > current_user.id }) if params[:id] > if you want to get just one. That'

[Rails] Re: Re: Returning last value

2010-08-05 Thread bingo bob
Marnen, that makes an awful lot of things more clear - thanks for taking the time :-). -- 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...@goog

  1   2   3   >