Re: [Rails] Re: Accessing non-instance variables in view

2012-12-17 Thread Colin Law
On 18 December 2012 05:10, Praveen BK wrote: > Adding @ to a variable doesn make the variable instance variable, its > convention that are followed while writing a ruby program, I think... > > Here I have a variable x = 10, in my controller how can i access it in > view without using cookies. Don

[Rails] Re: Accessing non-instance variables in view

2012-12-17 Thread Praveen BK
Adding @ to a variable doesn make the variable instance variable, its convention that are followed while writing a ruby program, I think... Here I have a variable x = 10, in my controller how can i access it in view without using cookies. -- Posted via http://www.ruby-forum.com/. -- You receiv

[Rails] Re: Accessing non-instance variables in view

2012-12-17 Thread Praveen BK
Adding @ to a variable doesn make the variable instance variable, its convention that are followed while writing a ruby program, I think... Here I have a variable x = 10, in my controller how can i access it in view without using cookies. -- Posted via http://www.ruby-forum.com/. -- You rece

[Rails] Dislpaying validation errors from one one model to view of another.

2012-12-17 Thread Sumit Srivastava
Hi, I have a model, class UserComment belongs_to :user validates :player_id, :presence => true validates :comment, :uniqueness => { :scope => :player_id} partial "comments" from User. = simple_form_for @user, :html => {:class => 'comment-form'}, :remote => true do |f| %fieldset = f.fields

[Rails] problem with globalize3 : undefined method `create_translation_table!'

2012-12-17 Thread Guirec Corbel
Hello, I have the problem posted at this address : https://github.com/svenfuchs/globalize3/issues/172. I created a new project with a new model and I integrated globalize3. I created a migration like this : class CreatePages < ActiveRecord::Migration def up create_table :p

Re: [Rails] callbacks

2012-12-17 Thread Jim Ruther Nill
On Mon, Dec 17, 2012 at 10:15 PM, Avi wrote: > Hello All, > > I have two tables: > user has_many room > room belongs_to user > > When a new user is created, I want to save the room through some default > values at the same time. > How to do this by using callbacks? > > after_save or after_create

Re: [Rails] my PHP buddy...

2012-12-17 Thread Walter Lee Davis
On Dec 17, 2012, at 1:41 PM, Erwin wrote: > I am a Rails dev (Rails 3.2.9 / MySQL / Haml ) working on some pilot projects > testing using TDD to get them running fine according to customer > requirements. You can compare this work to some 'story-boards' describing the > main features of the si

[Rails] my PHP buddy...

2012-12-17 Thread Erwin
I am a Rails dev (Rails 3.2.9 / MySQL / Haml ) working on some pilot projects testing using TDD to get them running fine according to customer requirements. You can compare this work to some 'story-boards' describing the main features of the site Once done, I'll transfer the code to my good PH

[Rails] callbacks

2012-12-17 Thread Avi
Hello All, I have two tables: user has_many room room belongs_to user When a new user is created, I want to save the room through some default values at the same time. How to do this by using callbacks? after_save or after_create ? & I want to use blocks with callbacks. Any suggestions?? Tha

[Rails] Re: Add expire header for images stored in amazon s3

2012-12-17 Thread Frederick Cheung
On Monday, December 17, 2012 9:07:07 AM UTC, Maddy wrote: > > Hi everyone Good Afternoon, > > I done adding expire header by put the following code into my product > model. > > :s3_headers => { 'Cache-Control' => 'max-age=315576000', 'Expires' > => > 10.years.from_now.httpdate }, > > But

[Rails] Re: Re: Filter on multiple select

2012-12-17 Thread Lorenz Blackbird
> Instead of Student.where(:course_id => @exam.course_id) use > @exam.course.students Good. Thanks Colin :) -- 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

Re: [Rails] Aceesing non-instance variables in view

2012-12-17 Thread Colin Law
On 17 December 2012 08:59, Praveen BK wrote: > Hi, I want pass a variable(which is not a instance variable) from > controller to view in rails application, onclick I am going to > controller and fetching data with ajax. Since the page is not reloaded I > cant set the variable in cookies. So is the

Re: [Rails] Re: Filter on multiple select

2012-12-17 Thread Colin Law
On 17 December 2012 08:49, Lorenz Blackbird wrote: > Sorry for the double post. > > I try to use squeel gem in this way: > > <%= f.select :students_ids, Student.where(:course_id => > @exam.course_id).map { |student| [student.name, student.id] }, { }, { > multiple: true } %> Instead of Student.whe

Re: [Rails] New Line

2012-12-17 Thread Colin Law
On 17 December 2012 06:56, Jordon Bedwell wrote: > On Mon, Dec 17, 2012 at 12:49 AM, Samir > wrote: >> <% @likes.each do |like| %> >> <%= like['name'] %> >> <% end %> >> >> Can some one tell me how to use puts here. so that i can get my outputs in a >> new line format. > > <%= %> is puts to the

[Rails] Re: Parsing Json to active record

2012-12-17 Thread rubyrookie
On Sunday, December 16, 2012 7:45:57 PM UTC-8, rubyrookie wrote: > > I want to take some elements from json string from > facebook > {"algorithm":"HMAC-SHA256","expires":1355720400,"issued_at":1355715753,"oauth_token":"AChvQA2sBAClBE0B40nw7YqrAuYNhOZCYJ4sZAMSZC8VFZAz81s2mndYbS7t2DxTzFkQ88FmX

[Rails] Re: undefined method `user_id=' for #

2012-12-17 Thread Sumit Srivastava
On Sunday, 16 December 2012 19:49:11 UTC+5:30, Nikolay wrote: > > After entering data in http://localhost:3000/checkout/update/address form > i getting the following error: > > NoMethodError in Spree::CheckoutController#update > > undefined method `user_id=' for # > > > A error chunk of Developm

[Rails] Add expire header for images stored in amazon s3

2012-12-17 Thread Maddy
Hi everyone Good Afternoon, I done adding expire header by put the following code into my product model. :s3_headers => { 'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate }, But its work only while i add new product and image. Already i have 100 of pro

[Rails] Aceesing non-instance variables in view

2012-12-17 Thread Praveen BK
Hi, I want pass a variable(which is not a instance variable) from controller to view in rails application, onclick I am going to controller and fetching data with ajax. Since the page is not reloaded I cant set the variable in cookies. So is there any way to pass a variable(which is not an instance

[Rails] Re: Filter on multiple select

2012-12-17 Thread Lorenz Blackbird
Sorry for the double post. I try to use squeel gem in this way: <%= f.select :students_ids, Student.where(:course_id => @exam.course_id).map { |student| [student.name, student.id] }, { }, { multiple: true } %> I replaced .all with .where(condition). After two days of tests I find this solutio

[Rails] Re: Filter on multiple select

2012-12-17 Thread Lorenz Blackbird
> I think you need to add a relationship between a course and a user and > use that relationship to figure out that list of student choices eligible > for the exam. In this project, any student can join only one course. In fact, the relationship between students and course is: belongs_to :course