[Rails] Apache shows contents of ruby script instead of actually executing it.

2012-12-22 Thread Brian A.
I'm trying to configure Passenger to serve a RadiantCMS. I believe I've installed all the necessary gems and followed the configuration instructions from here http://library.linode.com/frameworks/ruby-on-rails-apache/debian-6-squeeze, but am still having some issues with the static page, where it

Re: [Rails] question about html-pipeline

2012-12-22 Thread William Herry
thanks for you answer, it already out of any group, and I place it at the bottom still get error, maybe problem is not in installation (rails c can work) I place this code in my comment model (app/models/comment.rb) def markdown #require html/pipeline filter =

Re: [Rails] why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread Norbert Melzer
I do something similar in a project of mine. I have an API key and retrieve user information after he logs in. This works very fine in an after-find, why should that not work in a before_save? Can't provide the source right now. I have no access until Jan 8th. Am 21.12.2012 22:39 schrieb Dan

Re: [Rails] One model or many for a multistep form?

2012-12-22 Thread tamouse mailing lists
On Thu, Dec 20, 2012 at 5:49 AM, why-el wael.khobala...@gmail.com wrote: Anyway, so the giant form has personal information section, language information section (The biggest part, about a page and a half, this checks your current level of Arabic), and a track information section that presents

Re: [Rails] Need help on relationships between resources

2012-12-22 Thread tamouse mailing lists
On Fri, Dec 21, 2012 at 5:29 AM, Deepak Dhananjaya deepak.dhananj...@gmail.com wrote: I have started with Rails now, and I find difficult to understand the creation of relationship between two resources. Please show your code. -- You received this message because you are subscribed to the

[Rails] passing lambda when expecting an enumerable

2012-12-22 Thread John Merlino
Here are two methods defined in the Proc class, designed to be used for functional programming: def apply(enum) enum.map self end alias | apply def reduce(enum) enum.inject self end alias = reduce Here's an application of them: sum = lambda {|x,y| x+y } mean =

[Rails] Re: passing lambda when expecting an enumerable

2012-12-22 Thread John Merlino
ok I see what it;s doing. Its first calculating this part: (deviation|a) to check how far the elements deviate from the mean and returns an array of the differences. Then what happens next is that the square| is invoked on the returned array from above: square|deviation_returned_array So it

[Rails] evaluating expressions left to right

2012-12-22 Thread John Merlino
class Proc def apply(enum) enum.map self end alias | apply def reduce(enum) enum.inject self end alias = reduce def compose(f) if self.respond_to?(:arity) self.arity == 1 lambda {|*args| self[f[*args]] } else lambda {|*args| self[*f[*args]] } end end

[Rails] Re: Apache shows contents of ruby script instead of actually executing it.

2012-12-22 Thread Frederick Cheung
On Dec 22, 9:13 am, Brian A. li...@ruby-forum.com wrote: I'm trying to configure Passenger to serve a RadiantCMS. I believe I've installed all the necessary gems and followed the configuration instructions from herehttp://library.linode.com/frameworks/ruby-on-rails-apache/debian-6-sq...,

[Rails] Re: Apache shows contents of ruby script instead of actually executing it.

2012-12-22 Thread Brian A.
Ah, the loadmodule line was there but I had accidentally indented the PassengerRoot and PassengerRuby directives in httpd.conf. It's working now (well, almost, but fixing the other issues should be easy enough). -- Posted via http://www.ruby-forum.com/. -- You received this message because you

Re: [Rails] why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread Matt Jones
On Friday, 21 December 2012 13:12:35 UTC-5, Dan Brooking wrote: So is the way I'm doing it right? Or just a way I happened to hack it to work? The way my code was looking was basically: Page.new(:url = 'http://www.yahoo.com') class Page ActiveRecord::Base attr_accessible :url,

[Rails] Re: why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread 7stud --
Frederick Cheung wrote in post #1089897: Because rails doesn't use individual instance variables to store your attributes (whether they've been marked as attr_accessible makes no difference) title = foo Doesn't work because ruby assumes that you want to assign to the local variable called

[Rails] Re: why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread 7stud --
7stud -- wrote in post #1089991: And here is how to correct the problem: class Dog def title=(val) @title = val.capitalize end def do_stuff self.title = mr. title + Dog end end puts Dog.new.do_stuff That should be: class Dog def title=(val) @title =