Rails plugin to separate markup and logic, like Wicket or Effigy - ruby-on-rails

I need a Rails plugin that gives you the chance to purely separate HTML and any logic in your views. Views should be classes reading the separate markup and replacing it with dynamic content where needed.
Basically Effigy from github does this.
I am looking for something like Wicket, but on the Rails base.
I can remember seeing a plugin from a Rails enterprise that does this. In my memory, it was better and seemed more mature than Effigy. But I forgot its name. It was something like "luxurious" or "delicious"; does anyone know what I am talking about? The plugin was created in a US Rails enterprise.
Any other alternatives would be much appreciated.
I feel that Effigy is almost OK, but it's hard to find tutorials or people using it properly, so I question its the maturity.
Well, if nothing comes up, I will go ahead with Effigy for now.

All right guys, I think I finally found what I was talking about.
The plugin is called "Erector"
The thing that I like about it, is that views are finally plain ruby objects and you can do everything you can usually do in ruby. I found couple of blogposts:
https://github.com/erector/erector
Why I always liked this idea you can easily see in this blogpost
I want to thank the creators for this.

Related

Apotomo alternative

The information on the home page of the project I'm working has been piling up that now we are looking for something to create a dashboard-like interface.
That's how I found Apotomo, but I'm wondering what would be some alternatives worth looking into.
So far, I've looked through the Rails Presenters on ruby-toolbox.
Thankful for any suggestions to speed-up the development.
ActiveAdmin has a nice dashboard, might be worth checking out. Here it is on their demo and the commented code

Ruby on Rails customer-facing formbuilder?

I have a customer that wants to build their own questionnaires. Something like WuFoo (www.wufoo.com) but more secure and contained within the app.
I've looked at Smerf (http://github.com/springbok/smerf) which provides the yaml-to-form conversion, but I'd like something the user can use to create their own forms.
I would look at using active_scaffold. The main version has not been updated for Rails 3, but a fork at the location below has. I think it would work well for your purpose, you just need a way to grab the data and feed it in. Here is a demo of what it looks like when it is running:
https://github.com/vhochstein/active_scaffold
Here is a demo at the top of the page:
http://demo.activescaffold.com/roles
You could always embed Google Forms. Might be easier than reinventing the wheel. Unless you have some specific use case this doesn't cover?
If you are not adverse to going the Javascript route the then you might consider one of the many framework plugins like the JQuery Form Builder. From a usability perspective it seems to me that any good solution is going to involve some Javascript. There should be no reason why this approach wouldn't integrate well into a Rails backend
You might want to check out this one. Dynamic Forms
I too am looking for something very similar. What solution did you come up with?

Solution for comments for a Rails application

I'm introducing comments into a Rails application, and, being exceptionally lazy, I'm looking for a plugin to do it for me. I came across acts-as-commentable, but I didn't find much else. Acts-as-commentable seems fine, but it doesn't have support for threading.
Of course, it wouldn't be too hard just to home-brew the entire thing, but I think that surely commenting is such a common feature that there should be a canonical plugin to handle it. Can somebody with perhaps more Google Fu than me point me in the right direction?
This is acts_as_commentable_with_threading plugin which help you for threaded comment.
Link::
http://github.com/elight/acts_as_commentable_with_threading
The most lazy approach would be to use third-party commenting system like DISQUS : just copypaste a couple of javascripts and you're done.
Surely, it can't be used if your app has an authentication system of its own.
If you do not want to integrate a third-party service like Disqus, you have Juvia The Comments and Commontator. Also you can count with opinio as alternative. but only with Rails 3 and at the moment and as notice the development seems stalled.

Rails authorization plugins

We are evaluating plugins for Authorization in Rails. The two at the top of our list are
cancan and declarative_authorization.
I would like to get some feedback from anyone currently using either of these plugins.
The problem we are going to face with any authorization plugin is that we have a
database per customer model and will need to modify the plugin to work within that
model. Because of this fact I'm interested in hearing from anyone who has had to tweak the
plugins at all as well.
I'm just starting to look around at the code. It seems like cancan might be a little easier to customize.
Any thoughts?
Cancan is a lighter weight plugin for smaller sites. You can see a video on railscasts.
http://railscasts.com/episodes/192-authorization-with-cancan
I've used declarative_authorization with authlogic/restful_auth for several projects. It has everything you would need. 1) Model security. 2) Controller security 3) methods available to the view to check auth.
The only frustrating thing I've run into with declarative_authorization is me not reading the rdocs.
http://railscasts.com/episodes/188-declarative-authorization
Authority
I'd suggest you also check out my new gem, Authority. Because you do the actual logic in plain Ruby classes and methods, you can check any data source you need to: different databases, static files, phases of the moon via a web request, you name it. :)
I ended up using declarative_authorization. Now it seems that auth_logic is where the community is headed.
declarative_auth would have been really simple if it wasn't for our apps multi-tennant db
model. I had to modify the source a bit to make it all work, but it wasn't too tough to do, and
I was pretty green when I started this project.
It seems like you really can't go wrong with any of the solutions. cancan seemed cool too
but it would have needed more mods for what I was doing so I decided against it.
Its written by Ryan Bates though which is cool. Love rails casts! :)
I know this post is old but I figured I'll update any because you never know.

Designing Web Sites with Ruby on Rails

I'm just learning Ruby on Rails. I've read a few books, I've watched lots of Railscasts, I've looked at some examples.
However, when working on my first serious project with Rails, I've gotten hung up on how to properly implement some very basic web site features that most tutorials I've seen lack.
For instance: Navigation menus. Lots of tutorials on how to make a static one, but what about dynamic? If I want to make a navigation bar that's different across pages, how would I go about doing that?
I think that the best way to learn things like this is by seeing example code. Are there any good open sourced sites in RoR? Any example code that I can check out?
I guess my question really results to using MVC. The basic idea is really basic, and I understand that. But it seems that most applications have each part completely separate from each other... what if I want to, say, combine data from two models to display on the same page? To take the example I posed, if I have a NavModel and a PageModel, can my PageController access both models? I guess I'd assumed that a PageController can only access a PageModel, and none other. All examples I've seen seem to operate this way...is that a faulty assumption?
Or am I totally missing the point, and is that 'doing it wrong?'
Open Source Rails is a repository of sites implemented in rails.
Which books have you read? I think a better understanding of MVC and Rails would help you more in the long run than sample code, which you may be tempted to copy without understanding.
The problem you're describing isn't really different from finding and displaying any kind of data, which I'm sure you've seen covered in snippets on blogs, etc. (using partials and/or layouts is maybe the only difference).
If you haven't read them already, you should try Agile Web Development with Rails and The Rails Way.
There are also several books that take you through building a sample application that include commentary to make sure you understand what you're doing.
This might help: Dynamic navigation menu using Menuitem model
Your controller can access any of your models, so if PageController needs to access your NavModel that's fine. I think typically the Nav controller or helper would contain the methods necessary to prepare the navigation view, but without knowing the details of your project I can't say for sure - if you think it's part of the Page logic, then put it there.
You may also be interested in this "What goes where" question.
Heres a howto on highlighting the current menu item in the page you are on
http://snippets.dzone.com/posts/show/2016

Resources