RoR admin system


#1

I’m preety new at RoR (and programming), I tried a few tutorials, and
really like the RoR simplicity, but my knowledge of the framework still
isn’t very good (to be true, i understand the basics, but not everything
that’s in the tutorials).

But still I’d like to create a website which has:

  • front end interface (with no edit functions)
  • admin interface (with edit functions for articles, pictures, etc, …)

I’m interested if there are any similar systems “on the market”, any
tutorials, or any hints for a total n00b :wink:


#2

Most any Rails tutorial will cover scaffolding. This provides all
your CRUD operations. To prevent users from doing anything other than
viewing the items, you can just use some authentication and protect
the admin actions. Look into the login_generator, instructions are on
the wiki. So basic steps are

  1. Create Rails app
  2. Create database and table for your model
  3. Generate scaffolding for your model
  4. Install login_generator and protect your controller, except for the
    list/show actions

There are many other authentication systems, and you can write your
own of course, but if you just want to quickly put up a site to do
that, those are the steps you need to take to just get started
learning.

Pat


#3

Thanks for the idea! I’ve done everything except part 4., so I’d better
get on with it :wink:


#4

I would recommend you look at the login_engine, over the direct
login_generator. For someone starting out I found the login_engine
pretty
easy to implement. Not to say you shouldn’t look at them both, but I
found
the login_engine and the associated tutorial videos to be extremely
helpful.

Michael T.


#5

<% unless session[:user].nil? %>
<%= link_to ‘Edit’, :action => ‘edit’, :id => post %>
<% end %>

Whenever a user is logged in, he will see the link. When he’s not
logged in, he won’t.

Also you should ensure that you use before_filter to protect the admin
methods.

Pat


#6

Basicly what I want to do is that Pat M.'s #4, but just can’t
understand how to disable edit functions …

For examlpe: the part of the code: (<%= link_to ‘Edit’, :action =>
‘edit’, :id => post %>) has to be invisible to unregistered users. But
how to do it … that’s a big problem in my designer brain :slight_smile:


#7

… configure the application.rb something like:

before_filter :require_login, :only => [ :list, :show ] ?!?


#8

Davorin P. wrote:

… configure the application.rb something like:

before_filter :require_login, :only => [ :list, :show ] ?!?

I figured that one out … in blog_controller i have to define required
login …

before_filter :login_required, :only => [:edit, :destroy]


#9

… but I still don’t have a clue why “nil.title” in
_post.rhtml???


#10

Thx! This works superb … in ‘list’, ‘edit’ all except ‘show’ …

in show.rhtml i have a render partial funcion

<%= render :partial => “post”, :object => @post %>

and in _post there is an error no line #2

<%= link_to post.title, :action => ‘show’, :id => post %> …

… and the error is:

NoMethodError in Blog#show

Showing app/views/blog/_post.rhtml where line #2 raised:

You have a nil object when you didn’t expect it!
The error occured while evaluating nil.title

I suppose I should configure tle


#11

Download typo or Rforum and go thru their code. It will be more helpful

On 1/31/06, Davorin P. removed_email_address@domain.invalid wrote:

Rgds,
–Siva J.
http://www.varcasa.com/
My First Rails Project. Powered by Typo and soon by RForum too


#12

http://en.wikipedia.org/wiki/Cargo_cult

On 1/30/06, Michael T. removed_email_address@domain.invalid wrote:

I would recommend you look at the login_engine, over the direct
login_generator. For someone starting out I found the login_engine pretty
easy to implement. Not to say you shouldn’t look at them both, but I found
the login_engine and the associated tutorial videos to be extremely helpful.


Tobi
http://jadedpixel.com - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog


#13

If you follow along with the tutorial in DHH’s Rails book, it goes about
doing just this. It uses two controllers to provide the admin & end-user
functionality separation.


#14

Davorin P. wrote:

… but I still don’t have a clue why “nil.title” in
_post.rhtml???

Thx, I figured it out … I had a show.rhtml viewer, but no show action
in blog_controller … I just did

def new
@post = Post.new
end

in blog_controller, and it works.

To do list:

  • make damn css and image linking work
  • module for links, categoris, advanced user system and managing,
  • file upload (multiple), auto resize, autocrop …

Miles to go before I sleep (you musn’t forget, I’m just a web designer
with very little experience in programming at al).


#15

On Jan 31, 2006, at 2:46 PM, Tobias L. wrote:

lol @ Tobi

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid