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.
Davorin (Guest)
on 2006-01-30 12: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 ;)
Pat M. (Guest)
on 2006-01-30 12: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
Davorin (Guest)
on 2006-01-30 13:00
Thanks for the idea! I've done everything except part 4., so I'd better
get on with it ;)
Michael T. (Guest)
on 2006-01-30 17: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 T.
Davorin P. (Guest)
on 2006-01-31 11:36
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 :)
Pat M. (Guest)
on 2006-01-31 13: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
Davorin P. (Guest)
on 2006-01-31 15: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
Davorin P. (Guest)
on 2006-01-31 16:14
... configure the application.rb something like:

before_filter :require_login, :only => [ :list, :show ] ?!?
Davorin P. (Guest)
on 2006-01-31 19:52
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]
Davorin P. (Guest)
on 2006-01-31 19:53
... but I still don't have a clue why "nil.title" in
_post.rhtml?!??????????
Siva J. (Guest)
on 2006-01-31 22:53
(Received via mailing list)
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
Tobias L. (Guest)
on 2006-02-01 00:48
(Received via mailing list)
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
Ezra Z. (Guest)
on 2006-02-01 01:42
(Received via mailing list)
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
Corey L. (Guest)
on 2006-02-01 21: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.
Davorin P. (Guest)
on 2006-02-02 09:15
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).
This topic is locked and can not be replied to.