Hi *, I have started to use Rails some time ago now (coming from a predominant J2EE background) and I was wondering if Rails has something like what JSF provides: a way to define "components", which handle decoding values, conversion, rendering, updating their model pieces very much on their own - and which can easily be reused across many applications. What I have found in Rails regarding components is the render_component function and the ability to define "components" - which is on the large side for what I am thinking of, I''d rather call these "components" "application modules" or so. Is there anything on a smaller level? regards, Martin
Hi ! 2005/11/3, Martin Marinschek <martin.marinschek@gmail.com>:> What I have found in Rails regarding components is the > render_component function and the ability to define "components" - > which is on the large side for what I am thinking of, I'd rather call > these "components" "application modules" or so.What is a component for you, then ? render allows you to render anything you might want: files, partials, actions, components, or nothing. There is also Rails Engines[1], then you wait to define components or reusable application modules. Hope that helps. -- François Beausoleil blog.teksol.info rails-engines.rubyforge.org _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Francois Beausoleil wrote:> Hi ! > > 2005/11/3, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >>What I have found in Rails regarding components is the >>render_component function and the ability to define "components" - >>which is on the large side for what I am thinking of, I''d rather call >>these "components" "application modules" or so. > > > What is a component for you, then ? render allows you to render > anything you might want: files, partials, actions, components, or > nothing. > > There is also Rails Engines[1], then you wait to define components or > reusable application modules.If components seem a little large, maybe helpers are what''s needed? -- Alex
Right, the render side of things. But that''s just part of what happens in a web app, right? In JSF, a component is something integrated - it does decoding, rendering, updating, converting, validating all by itself - am I blind or do I just not see anything like this in Rails? Don''t take my question as an offence - I just want to find out for myself how things work together, and usually the concepts are kind of comparable between the web-frameworks. I am really loving how Rails helps with RAD - however, I found this component concept one good point about JSF and I thought there might have been something like this in the "new world" as well. regards, Martin On 11/3/05, Francois Beausoleil <francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi ! > > 2005/11/3, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > What I have found in Rails regarding components is the > > render_component function and the ability to define "components" - > > which is on the large side for what I am thinking of, I''d rather call > > these "components" "application modules" or so. > > What is a component for you, then ? render allows you to render > anything you might want: files, partials, actions, components, or > nothing. > > There is also Rails Engines[1], then you wait to define components or > reusable application modules. > > Hope that helps. > -- > François Beausoleil > blog.teksol.info > > rails-engines.rubyforge.org >-- irian.at Your JSF powerhouse - JSF Trainings in English and German
It sounds like you are talking about what Rails Engines provides - self-contained controllers/views/models which can be shared across multiple applications. The README might make things clearer: rails-engines.rubyforge.org/rdoc/engines - James On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi *, > > I have started to use Rails some time ago now (coming from a > predominant J2EE background) and I was wondering if Rails has > something like what JSF provides: a way to define "components", which > handle decoding values, conversion, rendering, updating their model > pieces very much on their own - and which can easily be reused across > many applications. > > What I have found in Rails regarding components is the > render_component function and the ability to define "components" - > which is on the large side for what I am thinking of, I''d rather call > these "components" "application modules" or so. > > Is there anything on a smaller level? > > regards, > > Martin > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >
Maybe it''s me, but engine sounds too big for a component. Did you consider something "Rail Pegs'' or ''Rail Gears'' or something like that? Cheers, Nick On 11/3/05, James Adam <james.adam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It sounds like you are talking about what Rails Engines provides - > self-contained controllers/views/models which can be shared across > multiple applications. The README might make things clearer: > > rails-engines.rubyforge.org/rdoc/engines > > - James > > On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi *, > > > > I have started to use Rails some time ago now (coming from a > > predominant J2EE background) and I was wondering if Rails has > > something like what JSF provides: a way to define "components", which > > handle decoding values, conversion, rendering, updating their model > > pieces very much on their own - and which can easily be reused across > > many applications. > > > > What I have found in Rails regarding components is the > > render_component function and the ability to define "components" - > > which is on the large side for what I am thinking of, I''d rather call > > these "components" "application modules" or so. > > > > Is there anything on a smaller level? > > > > regards, > > > > Martin > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- Nicholas Van Weerdenburg
On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Right, the render side of things. But that''s just part of what happens > in a web app, right? > > In JSF, a component is something integrated - it does decoding, > rendering, updating, converting, validating all by itself - am I blind > or do I just not see anything like this in Rails? > > Don''t take my question as an offence - I just want to find out for > myself how things work together, and usually the concepts are kind of > comparable between the web-frameworks. I am really loving how Rails > helps with RAD - however, I found this component concept one good > point about JSF and I thought there might have been something like > this in the "new world" as well.There''s nothing like this in Rails currently. I came from the ASP.net with Server Controls (I believe they''re similar in concept to JSF Components?), but I am very relieved that I don''t have to deal with that mess anymore. Rails generally takes a simple, low-tech approach. Define forms in the view, save the data in the controller. If you use the great defaults that ActiveRecord provides, your form saving bit will be: @article.update_attributes(params[:articles]) What about more complex widgets that need controller interaction for ajax calls? Take a look at the simple Autocompletion demo: script.aculo.us/demos/ajax/autocompleter . It uses a simple helper to generate your view code, and a controller macro to set up the controller actions. It is also simple to extend the default behavior a bit, as demonstrated in the more advanced demo: script.aculo.us/demos/ajax/autocompleter_customized Is there a specific problem you''re trying to solve that you can''t solve with the current model that rails uses? -- rick techno-weenie.net
I just checked out Rails Engines and read the Readme, but first - I still think it is too large for what I mean second - I don''t understand the component character fully from the readme - as the engine has an integrated model as far as I see, but for me the component model should come from the outside. @first I am rather talking about something like a "calendar" or a "tree" component (control?) - I want to render a calendar on a page, bind it to a model value, and want to make sure that the value the user chooses is posted back to the model without further ado. This calendar can then be used wherever and whenever necessary - just change the "binding". This binding should be really easy with ruby and symbols, right? @second I see that the whole thing is a package - but what''s the interface to the rest of my app? I saw documentation for the configuration interface, but how can I change e.g. the connections with my backend model? Sorry if I have a screwed up component understanding and you can''t follow what I mean - blame it on J2EE if you want to so ;). regards, Martin On 11/3/05, Nicholas Van Weerdenburg <vanweerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Maybe it''s me, but engine sounds too big for a component. Did you > consider something "Rail Pegs'' or ''Rail Gears'' or something like that? > > Cheers, > Nick > > On 11/3/05, James Adam <james.adam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > It sounds like you are talking about what Rails Engines provides - > > self-contained controllers/views/models which can be shared across > > multiple applications. The README might make things clearer: > > > > rails-engines.rubyforge.org/rdoc/engines > > > > - James > > > > On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi *, > > > > > > I have started to use Rails some time ago now (coming from a > > > predominant J2EE background) and I was wondering if Rails has > > > something like what JSF provides: a way to define "components", which > > > handle decoding values, conversion, rendering, updating their model > > > pieces very much on their own - and which can easily be reused across > > > many applications. > > > > > > What I have found in Rails regarding components is the > > > render_component function and the ability to define "components" - > > > which is on the large side for what I am thinking of, I''d rather call > > > these "components" "application modules" or so. > > > > > > Is there anything on a smaller level? > > > > > > regards, > > > > > > Martin > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Nicholas Van Weerdenburg > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- irian.at Your JSF powerhouse - JSF Trainings in English and German
P.S.: So for the Rails Engines - I''d rather call them "modules" again instead of "components" or "controls". Maybe I should have called what I was searching for "control" right from the beginning. regards, Martin On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I just checked out Rails Engines and read the Readme, but > > first - I still think it is too large for what I mean > > second - I don''t understand the component character fully from the > readme - as the engine has an integrated model as far as I see, but > for me the component model should come from the outside. > > @first > > I am rather talking about something like a "calendar" or a "tree" > component (control?) - I want to render a calendar on a page, bind it > to a model value, and want to make sure that the value the user > chooses is posted back to the model without further ado. This calendar > can then be used wherever and whenever necessary - just change the > "binding". This binding should be really easy with ruby and symbols, > right? > > @second > > I see that the whole thing is a package - but what''s the interface to > the rest of my app? I saw documentation for the configuration > interface, but how can I change e.g. the connections with my backend > model? > > Sorry if I have a screwed up component understanding and you can''t > follow what I mean - blame it on J2EE if you want to so ;). > > regards, > > Martin > > On 11/3/05, Nicholas Van Weerdenburg <vanweerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Maybe it''s me, but engine sounds too big for a component. Did you > > consider something "Rail Pegs'' or ''Rail Gears'' or something like that? > > > > Cheers, > > Nick > > > > On 11/3/05, James Adam <james.adam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > It sounds like you are talking about what Rails Engines provides - > > > self-contained controllers/views/models which can be shared across > > > multiple applications. The README might make things clearer: > > > > > > rails-engines.rubyforge.org/rdoc/engines > > > > > > - James > > > > > > On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi *, > > > > > > > > I have started to use Rails some time ago now (coming from a > > > > predominant J2EE background) and I was wondering if Rails has > > > > something like what JSF provides: a way to define "components", which > > > > handle decoding values, conversion, rendering, updating their model > > > > pieces very much on their own - and which can easily be reused across > > > > many applications. > > > > > > > > What I have found in Rails regarding components is the > > > > render_component function and the ability to define "components" - > > > > which is on the large side for what I am thinking of, I''d rather call > > > > these "components" "application modules" or so. > > > > > > > > Is there anything on a smaller level? > > > > > > > > regards, > > > > > > > > Martin > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > > Nicholas Van Weerdenburg > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > > irian.at > Your JSF powerhouse - > JSF Trainings in English and German >-- irian.at Your JSF powerhouse - JSF Trainings in English and German
Ok - I see. I rather liked the "control" approach, well, I''ll need to drop this concept over board then when doing rails. this question wasn''t for solving a particular technical problem, it really was for finding something I hadn''t found in rails so far. Thanks for the definitive answer! regards, Martin On 11/3/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Right, the render side of things. But that''s just part of what happens > > in a web app, right? > > > > In JSF, a component is something integrated - it does decoding, > > rendering, updating, converting, validating all by itself - am I blind > > or do I just not see anything like this in Rails? > > > > Don''t take my question as an offence - I just want to find out for > > myself how things work together, and usually the concepts are kind of > > comparable between the web-frameworks. I am really loving how Rails > > helps with RAD - however, I found this component concept one good > > point about JSF and I thought there might have been something like > > this in the "new world" as well. > > There''s nothing like this in Rails currently. I came from the ASP.net > with Server Controls (I believe they''re similar in concept to JSF > Components?), but I am very relieved that I don''t have to deal with > that mess anymore. Rails generally takes a simple, low-tech approach. > Define forms in the view, save the data in the controller. If you > use the great defaults that ActiveRecord provides, your form saving > bit will be: > > @article.update_attributes(params[:articles]) > > What about more complex widgets that need controller interaction for > ajax calls? Take a look at the simple Autocompletion demo: > script.aculo.us/demos/ajax/autocompleter . It uses a simple > helper to generate your view code, and a controller macro to set up > the controller actions. It is also simple to extend the default > behavior a bit, as demonstrated in the more advanced demo: > script.aculo.us/demos/ajax/autocompleter_customized > > Is there a specific problem you''re trying to solve that you can''t > solve with the current model that rails uses? > > -- > rick > techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- irian.at Your JSF powerhouse - JSF Trainings in English and German
On 11/3/05, Martin Marinschek <martin.marinschek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok - I see. > > I rather liked the "control" approach, well, I''ll need to drop this > concept over board then when doing rails. > > this question wasn''t for solving a particular technical problem, it > really was for finding something I hadn''t found in rails so far. > > Thanks for the definitive answer! > > regards, > > MartinWell, you can surely write an implementation if you desire. I''m writing a form toolkit for this publishing framework I''m working on. It takes the whole ''controller macro'' concept to a new level. Each column and form field is a different widget/control. I''ve since added date select boxes, file uploaders, etc. class Admin::UsersController < ApplicationController layout ''administration'' admin_for :user do |a| a.list_view do |l| l.column :login l.column :email, :classes => :email l.column :logged_in_at, ''Last Login'' do |value| value.to_formatted_s(:db) # custom value output end l.column :active?, ''Active'' l.search_by :login l.search_by :email l.search_by :login, :email, :operation => :or end a.form_view do |f| f.field :login f.field :email f.field :password, :password_field f.field :password_confirmation, :password_field f.field :active, :check_box end a.confirm_delete_with :email end end This works for me and my project, but I''m not quite sure this is where Rails should go. I''m nowhere near satisfied with it, but I have four sites in various states being built with it, and it seems to be working well. More on my blog (with the firefox-killa flash screencast)... techno-weenie.net/blog/index.php?q=administration -- rick techno-weenie.net