[Rails] Re: No validation_context methods in Rails API. What for are they?

2013-04-15 Thread Justin T.
You could use this gem to validate email addresses: https://github.com/alexdunae/validates_email_format_of You should be able to use it without needing AR, as well. On Monday, April 15, 2013 6:16:13 PM UTC-4, Ruby-Forum.com User wrote: > > Gintautas S. wrote in post #1105766: > > private/protect

Re: [Rails] Dynamically generating models and/or migrations at runtime

2013-04-15 Thread tamouse mailing lists
Did you ask this question twice? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, sen

Re: [Rails] Dynamic creation of models and/or tables in Rails

2013-04-15 Thread tamouse mailing lists
On Sun, Apr 14, 2013 at 7:19 PM, wrote: > I'm working on a project at the moment that has a rather unusual requirement > and I'm hoping to get some advice on the best way to handle it or even some > pointers to info that can help me build a solution. > > Ok, so this is what I need to do. The appl

Re: [Rails] rails named scopes and sql injection

2013-04-15 Thread Julian Leviston
It'd take less time that replying to this email. You should always teach yourself with micro-experiments where possible IMHO. Julian On 15/04/2013, at 7:29 PM, and...@benjamin.dk wrote: > I just dont have the time right now to try this. just wanted to see if there > was any documentation the s

Re: [Rails] Dynamic creation of models and/or tables in Rails

2013-04-15 Thread Julian Leviston
I guess I would probably use the one table, and use single table inheritance on each of your "deploys" if I've understood what you mean correctly. Each subclass model could "rename" fields according to its purpose... of course, it all depends what you want to do with the metadata in the end. Th

Re: [Rails] Using ActiveRecord to add data on record load

2013-04-15 Thread Julian Leviston
On 15/04/2013, at 1:27 AM, Peter Hicks wrote: > All, > > I've been struggling to find a neat solution to this problem for a couple of > weeks now, so I'd love to hear anyone else's opinion. I'm on Rails 3.2.13 > and Ruby 1.9.3-p392. > > I have a table of train schedules, and a table of tra

[Rails] Re: No validation_context methods in Rails API. What for are they?

2013-04-15 Thread Wins Lin
Gintautas S. wrote in post #1105766: > private/protected methods? What r u trying to accomplish? > -- > Pagarbiai, > Gintautas I want to validate data from a form - an email string and a password string. The Rails do not have special validator classes for the common use cases (emails, digits, ip'

Re: [Rails] No validation_context methods in Rails API. What for are they?

2013-04-15 Thread Gintautas Šimkus
private/protected methods? What r u trying to accomplish? 2013/4/16 Wins Lin > There is no validation_context methods in API. But the instance has > them: > validation_context > validation_context= > > What are these methods? What do they do? Where to get info about them? > > -- > Posted via ht

[Rails] No validation_context methods in Rails API. What for are they?

2013-04-15 Thread Wins Lin
There is no validation_context methods in API. But the instance has them: validation_context validation_context= What are these methods? What do they do? Where to get info about them? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Googl

Re: [Rails] Fail to pass id to foreign table

2013-04-15 Thread Colin Law
On 15 April 2013 21:22, Ryo Saeba wrote: > I'm working on a videogame database, where users can signup, make game > entries, rate and review them. > > I have the Models: User, Game, Rating and Review. Each user can give his > own rating to any game, so I have to pass the game.id to the > ratings.g

[Rails] Fail to pass id to foreign table

2013-04-15 Thread Ryo Saeba
I'm working on a videogame database, where users can signup, make game entries, rate and review them. I have the Models: User, Game, Rating and Review. Each user can give his own rating to any game, so I have to pass the game.id to the ratings.game_id in order to associate ratings to certain games

Re: [Rails] Re: Ruby on Rails installation

2013-04-15 Thread Colin Law
On 15 April 2013 07:02, Brahmaji Venkat wrote: > Hi All, > > I verey new to Ruby on Rails and am using windows xp 32 bit so any one can > explain how to install ruby on rails in windows xp machine My advise is not to use Windows, but use Linux (eg Ubuntu) or Mac instead. If you absolutely must u

[Rails] mounting engine in namespace

2013-04-15 Thread Erwin
I am testing an engine which normally is mounted at / NotifyMe::Application.routes.draw do > mount_opro_oauth :controllers => {:oauth_client_apps => > 'oauth/client_apps'} I am trying to mount it inside my existing backoffice namespace, is it possible or not advisable namespace :backo

Re: [Rails] Re: How to initialize variables automatically on application bootstrap?

2013-04-15 Thread tamouse mailing lists
On Mon, Apr 15, 2013 at 7:10 AM, Wins Lin wrote: > tamouse mailing lists wrote in post #1105626: >> On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists >> wrote: >> The Rails application is not brought up and shut down for every >> request. It lives in a long running process. > > But how it ca

Re: [Rails] How to initialize variables automatically on application bootstrap?

2013-04-15 Thread Walter Lee Davis
On Apr 15, 2013, at 8:10 AM, Wins Lin wrote: > tamouse mailing lists wrote in post #1105626: >> On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists >> wrote: >> >> Never mind, I mis-read what you wrote. >> >> ZF I'm assuming is Zend Framework, aka, PHP? Which works nothing like >> Rails, bt

[Rails] Re: How to initialize variables automatically on application bootstrap?

2013-04-15 Thread Wins Lin
tamouse mailing lists wrote in post #1105626: > On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists > wrote: > > Never mind, I mis-read what you wrote. > > ZF I'm assuming is Zend Framework, aka, PHP? Which works nothing like > Rails, btw, as you are essentially restarting the entire applicatio

[Rails] Re: How to initialize variables automatically on application bootstrap?

2013-04-15 Thread Wins Lin
Ricardo Franco wrote in post #1105627: > Maybe hardcoding them in a before_filter on ApplicationController... > > Which kind of variables are you talking about? Where do you plan to use > them? Yes, "before_filter" works just fine. Yet do not understand the details how it works but it works :) I

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Filip Matošić
Thx, helped alot, now I just: In my model attr_accessor :can_edit,:can_read In my controller i set the can_edit and simply respond_with(@scripts,:methods => [:can_edit,:can_view]) there is allso a as_json method you can put into the model and it overrides to_json so you do not need to write ",:m

Re: [Rails] rails named scopes and sql injection

2013-04-15 Thread andreo
I just dont have the time right now to try this. just wanted to see if there was any documentation the subject because I couldnt find anything that would tell me otherwise. but thanks for your help guys :) On Friday, 12 April 2013 15:49:42 UTC+2, Julian wrote: > > AFAIK, using the array syntax,

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Frederick Cheung
On Monday, April 15, 2013 8:46:22 AM UTC+1, Filip Matošić wrote: > > As zou have suggested i have done this by adding > attr_writer :can_edit,:can_read > to my model > and in my controller > @scripts.each do |script| > script[:can_edit]=can?(:edit,script) > end > Having defined the accessor you

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Filip Matošić
After some research i have added attr_accessor :can_edit,:can_read and now when I: @scripts.each do |script| script.can_edit=can?(:edit,script) logger.debug("Script#{script.to_yaml}") end I do not get any warning, but in my log can_edit is not being printed, allso if i json the result (@s

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Filip Matošić
I'm using: ruby 1.9.3p125 (2012-02-16 revision 34643) rails 3.2.13 activesupport (3.2.11) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Filip Matošić
As zou have suggested i have done this by adding attr_writer :can_edit,:can_read to my model and in my controller @scripts.each do |script| script[:can_edit]=can?(:edit,script) end but still getting the warning guess I'm doing something wrong, can you lead me in the right direction? Dana ponedjel

[Rails] Re: Dynamically generating models and/or migrations at runtime

2013-04-15 Thread Frederick Cheung
On Monday, April 15, 2013 2:24:43 AM UTC+1, reag...@magian.com wrote: > I'm working on a project at the moment that has a rather unusual requirement > and I'm hoping to get some advice on the best way to handle it or even some > pointers to info that can help me build a solution. > Ok, so this is

[Rails] Re: using angular and cancan in Rails application

2013-04-15 Thread Frederick Cheung
On Monday, April 15, 2013 8:18:18 AM UTC+1, Filip Matošić wrote: > Developing an application with angular I came into a problem. In my > application I use cancan ( https://github.com/ryanb/cancan ). > Now when showing data in a table i have to filter if the logged user can or > cannot edit, view

[Rails] Re: How todiffer if params are set through form or through url

2013-04-15 Thread Frederick Cheung
On Sunday, April 14, 2013 5:13:11 PM UTC+1, Ruby-Forum.com User wrote: > Is there a way to differ if params are set through form submit: > > or through url > > http://some.site/login?record[username]=user&record[password]=pwd > > In both cases they appear in controller as params[:record][:user]

[Rails] using angular and cancan in Rails application

2013-04-15 Thread Filip Matošić
Developing an application with angular I came into a problem. In my application I use cancan ( https://github.com/ryanb/cancan ). Now when showing data in a table i have to filter if the logged user can or cannot edit, view etc, and thus disabling buttons that allow given operations. When using

[Rails] Dynamic creation of models and/or tables in Rails

2013-04-15 Thread reagleton
I'm working on a project at the moment that has a rather unusual requirement and I'm hoping to get some advice on the best way to handle it or even some pointers to info that can help me build a solution. Ok, so this is what I need to do. The application stores and manages various types of me

[Rails] CANCAN and angular

2013-04-15 Thread Filip Matošić
I am a fairly new Rails developer, allso i begun to develop with angular as it gives sense and clarity. I have come up to a bit of a problem. I use CANCAN to manage user->role wrights, but now it gives me a very hard time to implement with angular in cases where i have a repeater, as i need to

[Rails] Dynamically generating models and/or migrations at runtime

2013-04-15 Thread reagleton
I'm working on a project at the moment that has a rather unusual requirement and I'm hoping to get some advice on the best way to handle it or even some pointers to info that can help me build a solution. Ok, so this is what I need to do. The application stores and manages various types of me

[Rails] Re: Ruby on Rails installation

2013-04-15 Thread Brahmaji Venkat
Hi All, I verey new to Ruby on Rails and am using windows xp 32 bit so any one can explain how to install ruby on rails in windows xp machine Thanks Venkat On Saturday, April 13, 2013 1:52:10 PM UTC+5:30, Ruby-Forum.com User wrote: > I am new to Ruby on Rails. I just installed the ROR taking

[Rails] Using ActiveRecord to add data on record load

2013-04-15 Thread Peter Hicks
All, I've been struggling to find a neat solution to this problem for a couple of weeks now, so I'd love to hear anyone else's opinion. I'm on Rails 3.2.13 and Ruby 1.9.3-p392. I have a table of train schedules, and a table of train schedule locations with a has_many association. Each schedu