Forum: Ruby on Rails RoR admin system

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin (Guest)
on 2006-01-30 11:20
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 ;)
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-01-30 11:32
(Received via mailing list)
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
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin (Guest)
on 2006-01-30 12:00
Thanks for the idea! I've done everything except part 4., so I'd better
get on with it ;)
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-01-30 16:17
(Received via mailing list)
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 Trier
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-01-31 10:36
Basicly what I want to do is that Pat Maddox'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 :)
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-01-31 12:19
(Received via mailing list)
<% 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
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-01-31 14:58
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
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-01-31 15:14
... configure the application.rb something like:

before_filter :require_login, :only => [ :list, :show ] ?!?
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-01-31 18:52
Davorin Pavlica 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]
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-01-31 18:53
... but I still don't have a clue why "nil.title" in
_post.rhtml?!??????????
33bb150cf13d87bce4e80569ca317647?d=identicon&s=25 Siva Jagadeesan (Guest)
on 2006-01-31 21:53
(Received via mailing list)
Download typo or Rforum and go thru their code. It will be more helpful

On 1/31/06, Davorin Pavlica <davorin@zvpl.com> wrote:
>
--

Rgds,
--Siva Jagadeesan
http://www.varcasa.com/
My First Rails Project. Powered by Typo and soon by RForum too
Df040ca3576504b24a73744179903277?d=identicon&s=25 Tobias Luetke (Guest)
on 2006-01-31 23:48
(Received via mailing list)
http://en.wikipedia.org/wiki/Cargo_cult

On 1/30/06, Michael Trier <mtrier@gmail.com> 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
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-02-01 00:42
(Received via mailing list)
On Jan 31, 2006, at 2:46 PM, Tobias Luetke wrote:

>
>
lol @ Tobi

Cheers-
-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
D1fb4423204d9440a1b7aacce50eb641?d=identicon&s=25 Corey Lawson (Guest)
on 2006-02-01 20:44
(Received via mailing list)
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.
9dfcab672548b76f53260c968e3bdb20?d=identicon&s=25 Davorin Pavlica (davorin)
on 2006-02-02 08:15
Davorin Pavlica 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).
This topic is locked and can not be replied to.