Enough rails for me
That's it, I've had enough of Ruby on Rails!
I like the rails part, it's a very clever approach, but I really dislike the Ruby part!
The final straw occurred yesterday. It's very common in OOP to have the constructor set default values for your object just in case the consumer of your class does not set them. In C# I would do something like this.....
public class Post : MyBaseClass
{
private bool isPost = true;
}
In Ruby I was trying to achieve this simple behaviour...
01: IsPost is set to true
02: A form is displayed with the default value
03: User changes the value
04: My Post instance is updated with the values from the form
I tried to override Initialize() only.
def Initialize
super
is_post = true
end
Now Post.new(params[:post]) is not reachable for some reason.
So in my Post class I did this
def Initialize(* params)
super(params)
is_post = true
end
The problem here is when I try to initialize the values from the form in my controller class.
post = Post.new(params[:post])
This means that the super(params) is called (which sets is_post to the value in the form) and then sets is_post = true. So my value is always true regardless of what the user enters.
So I tried putting "is_post = true" before the call to super, but that throws a null reference exception.
Finally someone told me to merge hashes like this
{:is_post => true}.merge(params);
super(params)
I don't recall the error, but that didn't work either.
I'm sorry, but ANY language that gives me this much hassle just to set a default is not worth it.
C# on rails, now *that* would be nice!
I like the rails part, it's a very clever approach, but I really dislike the Ruby part!
The final straw occurred yesterday. It's very common in OOP to have the constructor set default values for your object just in case the consumer of your class does not set them. In C# I would do something like this.....
public class Post : MyBaseClass
{
private bool isPost = true;
}
In Ruby I was trying to achieve this simple behaviour...
01: IsPost is set to true
02: A form is displayed with the default value
03: User changes the value
04: My Post instance is updated with the values from the form
I tried to override Initialize() only.
def Initialize
super
is_post = true
end
Now Post.new(params[:post]) is not reachable for some reason.
So in my Post class I did this
def Initialize(* params)
super(params)
is_post = true
end
The problem here is when I try to initialize the values from the form in my controller class.
post = Post.new(params[:post])
This means that the super(params) is called (which sets is_post to the value in the form) and then sets is_post = true. So my value is always true regardless of what the user enters.
So I tried putting "is_post = true" before the call to super, but that throws a null reference exception.
Finally someone told me to merge hashes like this
{:is_post => true}.merge(params);
super(params)
I don't recall the error, but that didn't work either.
I'm sorry, but ANY language that gives me this much hassle just to set a default is not worth it.
C# on rails, now *that* would be nice!
Comments
http://www.castleproject.org/monorail/index.html
Thats mvc.
kind regards
Frank
I really liked the "Rails" approach. It took urls in any form (but mainly controller/action/id) and produced a page for it, e.g.
http://host/article/read/24
This would execute the method "read" in a controller class named "article", passing it article id 24.
The controller wouldn't generate any HTML though. Instead it just set up the data needed, e.g.
@articles = article.find(:all)
Then a view would be rendered in views/article/read.rhtml - this rhtml would have ruby script embedded in it (like PHP still does), but this code was only for presentation, unlike the controller which is only for logic.
In RoR you are 100% in control of the output HTML so you can have more than 1 form etc.
That's the Rails part. I didn't like the Ruby language very much!
Active Record (the persistence framework) was nowhere near as flexible as ECO.
I have this trouble, I need to run my app in several database, Eco can help me in it, I need to run the app in linux, Eco don't help me in it, I don't know if in ECO IV the suport to mono is better, for that I am exploring other technology like, php, rubby and rail, cold fusion, any advice is welcome.
regards
Frank
The Rails part (akin to ASP .NET) is really nice, but the rest I do not like.
People keep telling me "mono" but I haven't tried it yet.
Someone also suggested MonoRails (from Castle) but I haven't had a chance to look at that either.
I know little of ColdFusion, but my friend used to develop it professionally, he wasn't happy that it was rewritten in Java.
PHP I didn't like, but that was a long time ago. I have heard there are Rails-like approaches for PHP but I haven't looked into it.