Forum: Ruby on Rails Engine and controller layout confusion

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.
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard (Guest)
on 2006-01-03 15:08
(Received via mailing list)
Hi all,

Installed the login_engine which is working. But I'm confused as to how
I tell
Rails to use the "/app/views/layout" rhtml files, when partials from the
login_engine are used from
"/vendor/plugins/login_engine/app/views/user".

Do I copy login.rhtml to /app/view/mgmt?
(mgmt is a controller name in my app)

Along the same line:

I also have a nil error on the line below:
if session[:user] = User.authenticate(params[:user][:login],
params[:user]
[:password])

Which seems correct (isn't it?) because it's in application.rb and the
login_engine use a model called user seemingly unknown in the
ApplicationController?

Can somebody tell me how to stick to Rails protocol on this?

Big thanx!

Grtz Gerard.



--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-04 11:12
(Received via mailing list)
On 1/3/06, Gerard <mailing@gp-net.nl> wrote:
> Installed the login_engine which is working. But I'm confused as to how I tell
> Rails to use the "/app/views/layout" rhtml files, when partials from the
> login_engine are used from "/vendor/plugins/login_engine/app/views/user".

Rails will use *any* views in your /app/views/<whatever> subfolders in
precidence over anything in the login engine.

> Do I copy login.rhtml to /app/view/mgmt?
> (mgmt is a controller name in my app)

Umm... are you saying that you want to use your 'mgmt' controller to
login? I'm not sure what you mean here, or rather what problem you are
trying to solve.

> I also have a nil error on the line below:
> if session[:user] = User.authenticate(params[:user][:login], params[:user]
> [:password])
>
> Which seems correct (isn't it?) because it's in application.rb and the
> login_engine use a model called user seemingly unknown in the
> ApplicationController?

Have you followed the installation instructions for the login engine?
If there is no 'User' model available, most likely you either

a) haven't installed the Engines plugin
b) haven't inserted a call to Engines.start at the bottom of your
environment.rb file
c) both of the above

- james
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard (Guest)
on 2006-01-04 11:30
(Received via mailing list)
James,

thanx for the response. Replies inline ...


> > Do I copy login.rhtml to /app/view/mgmt?
> > (mgmt is a controller name in my app)
>
> Umm... are you saying that you want to use your 'mgmt' controller to
> login? I'm not sure what you mean here, or rather what problem you are
> trying to solve.
login.rhtml didn't have the css layout I wanted. I did a symlink to
another
file. (and copied the user model. See below)
-rw-r-----  1 aaaaaa aaaaa 1402 Jan  4 11:19 mgmt.rhtml
lrwxrwxrwx  1 aaaaaa aaaaa   10 Jan  4 11:05 user.rhtml -> mgmt.rhtml

> > Which seems correct (isn't it?) because it's in application.rb and the
> > login_engine use a model called user seemingly unknown in the
> > ApplicationController?
>
> Have you followed the installation instructions for the login engine?
> If there is no 'User' model available, most likely you either
The user model was there but hidden in vendor/plugin/login_engine
somewhere.

I copied this one to /app/controllers/user_controller.rb. This works
now,
however there's one question. I couldn't get it working properly without
copying the user_controller.rb from the plugin directory to the
app/controller directory. Now it does all work. But if a newer version
of the
plugin is downloaded i've got two version in my environment. (I must
admit
I'm happy the way it works now btw).

And should I try to figure out how to make it work in th
plugin/..controller
directory and download a new version. My changes are lost.

Any suggestions on what's best practice in this case?

A very big thanx!

Regards,

Gerard.



--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
This topic is locked and can not be replied to.