Re: [Rails] Re: Validate presence before custom validation

2012-10-21 Thread Colin Law
On 20 October 2012 22:29, Eugeni Kurtov li...@ruby-forum.com wrote: Great, according to this logic system will take care for error messages and this will not take place, right? :) if start_at.nil? errors.add(:start_at, can't be blank) return if start_end.nil?

Re: [Rails] Is it possible to store the log file by day?

2012-10-21 Thread Colin Law
On 20 October 2012 14:28, leo108 cyh108...@gmail.com wrote: I hope to store the log file by day , because the log file will be so large with the time goes by.Is it possible to do this ? You could provide a daily cron task, something like cd /path/to/applicationRAILS_ENV=production rake

Re: [Rails] check box tag binding between controller and the view

2012-10-21 Thread Colin Law
On 21 October 2012 05:42, Muhammad Salman li...@ruby-forum.com wrote: I am new to RoR. The problem i am facing is that that i have a few check box and initially when i run my app for the first time i want them all to be selected while for every next time i want it to have the last checked

[Rails] load_missing_constant

2012-10-21 Thread Erwin
I have a model 'site' defined in a sub-folder 'cms' class Cms::Site ActiveRecord::Base . the model is loaded correctly , checked in console: application.rb config.autoload_paths += Dir[#{config.root}/app/models/**/] console Cms::Site.all = [] Now trying to access this model from a

[Rails] Re: load_missing_constant

2012-10-21 Thread Erwin
should it not be related to the nested namespace :backoffice :cms ? I'll try to change it to :backoffice :cms_admin On 21 oct, 11:34, Erwin yves_duf...@mac.com wrote: I have a model 'site' defined in a sub-folder 'cms' class Cms::Site ActiveRecord::Base  . the model is loaded

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
Thanks for your help Colin! My logs : Started GET /users/index for 127.0.0.1 at Thu Oct 18 23:01:19 +0200 2012 Processing by UsersController#index as HTML Rendered users/index.html.erb within layouts/application (0.6ms) Completed 500 Internal Server Error in 140ms

Re: [Rails] Is it possible to store the log file by day?

2012-10-21 Thread Victor Goff
On Sat, Oct 20, 2012 at 8:28 AM, leo108 cyh108...@gmail.com wrote: I hope to store the log file by day , because the log file will be so large with the time goes by.Is it possible to do this ? I am curious which log library you are using. From the standard library it is clear you can do

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread Colin Law
On 21 October 2012 11:45, chardy thibaud...@gmail.com wrote: Thanks for your help Colin! My logs : Started GET /users/index for 127.0.0.1 at Thu Oct 18 23:01:19 +0200 2012 Processing by UsersController#index as HTML Rendered users/index.html.erb within layouts/application (0.6ms)

Re: [Rails] Is it possible to store the log file by day?

2012-10-21 Thread Colin Law
On 21 October 2012 12:09, Victor Goff keeperotpho...@gmail.com wrote: On Sat, Oct 20, 2012 at 8:28 AM, leo108 cyh108...@gmail.com wrote: I hope to store the log file by day , because the log file will be so large with the time goes by.Is it possible to do this ? I am curious which log

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
Yes, good idea, now I can understand where is the problem : GET http://diufvm31.unifr.ch:8090/CyberCoachServer/resources/users/users.xml -- 404 Not Found 32 (129ms) The server is not configured to respond for .xml (or .json). The content type should be defined in the header... Is it possible

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread Hassan Schroeder
On Sun, Oct 21, 2012 at 7:06 AM, chardy thibaud...@gmail.com wrote: GET http://diufvm31.unifr.ch:8090/CyberCoachServer/resources/users/users.xml -- 404 Not Found 32 (129ms) The server is not configured to respond for .xml (or .json). If this server isn't under your control, shouldn't you

[Rails] Re: Rails CMS best fit

2012-10-21 Thread Erwin
Hi Oleg , I am working on it right now ... I like it being Rails- minded, so easier to hack , I also like it because it doesn't have any concept of users... I ma trying to move the 'cms-admin' module into my backoffice as a On 20 oct, 20:02, GBH oleg.khaba...@gmail.com wrote: Hey Erwin -

[Rails] Re: Rails CMS best fit

2012-10-21 Thread Erwin
been cut off.. I am trying to move the 'cms-admin' part into my backoffice as a lib module and using the cms-content for site rendering... I have an issue using the Cms::Site model , it works at app level ( getting Cms::Site.all = [] in the console but when called from the backoffice named

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
Yes, it's for a project in my university. I know that the we need to specify the format in the header and the server can handle json and xml format. Here is the documentation : Read only resources: - SportsResource / - Get list of all sports [GET, public] - UsersResource

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread Colin Law
On 21 October 2012 15:06, chardy thibaud...@gmail.com wrote: Yes, good idea, now I can understand where is the problem : GET http://diufvm31.unifr.ch:8090/CyberCoachServer/resources/users/users.xml Is the url supposed to be resources/users/users.xml? Perhaps it should just be

[Rails] Re: check box tag binding between controller and the view

2012-10-21 Thread Muhammad Salman
this worked for me = check_box_tag ratings[#{rating}], 1, (@selected_ratings.include? rating) -- 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

[Rails] Error occured while evaluating nil

2012-10-21 Thread Muhammad Salman
This is the code if !params[:ratings].nil? params[:ratings].each_key do |r| @selected_ratings r @movies Movie.where('rating = :rating', :rating = r) @sort = params[:sort] end elsif @selected_ratings = @all_ratings @movies = Movie.order(@sort) @sort

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread Hassan Schroeder
On Sun, Oct 21, 2012 at 7:44 AM, chardy thibaud...@gmail.com wrote: - UsersResource /users/ - Get list of all users [GET, public] Not much for documentation :-/ http://diufvm31.unifr.ch:8090/CyberCoachServer/resources/users returns an HTML page with a paginated listing of users, but that's

Re: [Rails] Error occured while evaluating nil

2012-10-21 Thread Colin Law
On 21 October 2012 16:20, Muhammad Salman li...@ruby-forum.com wrote: This is the code if !params[:ratings].nil? params[:ratings].each_key do |r| @selected_ratings r @movies Movie.where('rating = :rating', :rating = r) @sort = params[:sort] end elsif

Re: [Rails] Error occured while evaluating nil

2012-10-21 Thread Jordon Bedwell
On Sun, Oct 21, 2012 at 10:20 AM, Muhammad Salman li...@ruby-forum.com wrote: This is the code if !params[:ratings].nil? params[:ratings].each_key do |r| @selected_ratings r @movies Movie.where('rating = :rating', :rating = r) @sort = params[:sort] end

[Rails] Re: Error occured while evaluating nil

2012-10-21 Thread Muhammad Salman
Hi, Maybe i should explained a bit more about the problem. So the thing is that that i have a movie table in the database with properties such as titile, rating etc. Now i have a check box of ratings like ['G','PG','R']. When a user selects one or more of these check boxes then i have those in my

Re: [Rails] Re: Error occured while evaluating nil

2012-10-21 Thread Colin Law
On 21 October 2012 17:04, Muhammad Salman li...@ruby-forum.com wrote: Hi, Since you have not quoted the previous reply we do not know whether this is in reply to Jordan's suggestion. If it is in reply to his suggestion then you should quote it and make clear why it does not work. Colin

[Rails] Re: Re: Error occured while evaluating nil

2012-10-21 Thread Muhammad Salman
Colin Law wrote in post #1080610: On 21 October 2012 17:04, Muhammad Salman li...@ruby-forum.com wrote: Hi, Since you have not quoted the previous reply we do not know whether this is in reply to Jordan's suggestion. If it is in reply to his suggestion then you should quote it and make

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
Yes, sorry I made a mistake it's only users.xml but the problem is the same... Is it possible to retrieve the data without the extension .xml but just specify the type in the header? I have not found anything on the web... -- You received this message because you are subscribed to the Google

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
So, I tried to overwrite the methode collection_path : def collection_path(prefix_options = {}, query_options = nil) check_prefix_options(prefix_options) prefix_options, query_options = split_options(prefix_options) if query_options.nil?

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread Colin Law
On 21 October 2012 21:53, chardy thibaud...@gmail.com wrote: So, I tried to overwrite the methode collection_path : def collection_path(prefix_options = {}, query_options = nil) check_prefix_options(prefix_options) prefix_options, query_options = split_options(prefix_options)

Re: [Rails] Impossible to get data with ActiveResource

2012-10-21 Thread chardy
It's finally seems to work :) My ActiveResource model looks like this : class User ActiveResource::Base class self def element_path(id, prefix_options = {}, query_options = nil) check_prefix_options(prefix_options) prefix_options, query_options = split_options(prefix_options)

Re: [Rails] multiple select and preview of name of selected files

2012-10-21 Thread akvarel
So, did I get you right? Either I have to adapt PHP to Rails and change JQuery-File-Upload file upload action server/php to my file upload action or I have to adapt PHP to Rails and add the ID of the example form (do you mean form id=fileupload? ) to my Rails form_for [1] method and then

Re: [Rails] Is it possible to store the log file by day?

2012-10-21 Thread Victor Goff
On Sun, Oct 21, 2012 at 7:32 AM, Colin Law clan...@googlemail.com wrote: On 21 October 2012 12:09, Victor Goff keeperotpho...@gmail.com wrote: On Sat, Oct 20, 2012 at 8:28 AM, leo108 cyh108...@gmail.com wrote: I hope to store the log file by day , because the log file will be so large

Re: [Rails] Is it possible to store the log file by day?

2012-10-21 Thread Jordon Bedwell
On Sun, Oct 21, 2012 at 5:29 PM, Victor Goff keeperotpho...@gmail.com wrote: Can you use logrotate or whatever the OS gives for rotating logs? Yes I agree you should be using logrotate because most logging in applications is not rotated by them, but instead by logrotate, this way you can easily

Re: [Rails] multiple select and preview of name of selected files

2012-10-21 Thread Walter Lee Davis
On Oct 21, 2012, at 5:48 PM, akvarel wrote: So, did I get you right? Either I have to adapt PHP to Rails and change JQuery-File-Upload file upload action server/php to my file upload action or I have to adapt PHP to Rails and add the ID of the example form (do you mean form

[Rails] Noob question: Creating model associations

2012-10-21 Thread lyosha
I'm trying to create a simple blog app without scaffolding, and I'm having problems with associations. I'm relatively new to this, and I would love some help. I'm sorry for bugging you with such a newbie question, but I couldn't find a tutorial about this. I made my models like this: model g