Displaying 20 results from an estimated 10000 matches similar to: "Admin controller"
2005 Dec 28
3
Module loading
I''ve looked high and low for the answer to this and can''t seem to find
anything that helps.
I have an admin section (much like Typo) where all controllers are based
on the Admin::BaseController.
My directory structure is
[RAILS]
-app
--controllers
---admin
----base_controller.rb
----products_controller.rb
Products controller is:
class Admin::ProductsController <
2006 Aug 08
2
Extending rails with plugins
I''ve been looking at bottling some functionality up into a plugin, but I''m
having some problems including it.
The structure I have is:
/app/controllers/admin/base_controller.rb:
class Admin::BaseController > ApplicationController
#snip#
end
/vendor/plugins/myplugin/lib/my_module.rb:
module MyModule
def new_func
"New Function"
end
end
2013 Mar 20
2
Rspec + Devise + BaseController
Hello there,
I''m creating a base controller for the admin section of a project. All
controllers whitin the admin section will inherit from it.
#####################################################
#app/controllers/admins/base_controller.rb
class Admins::BaseController < ApplicationController
layout "admin_cms"
before_filter :authenticate_admin!
end
2010 Sep 09
17
formtastic issue
Hello,
I will try to explain it step by step :-)
I just created a new rails 3 app, then I created a new controller...
rails generate controller admin::users
I didn''t forget to add the resources in the routes.rb file like this.
namespace :admin do
resources :users
end
Now I try to use formtastic to create the form but I get erorr that my
users_path doesn''t exist?
2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi,
I have four controllers: one for the store front and three for the
store admin. In each controller I have copied and pasted exactly the
same code. It is a method called redirect_to() to override Action
Controller''s redirect_to(). Copy and paste is bad. I can think of two
options but I don''t know how Rails will feel about them.
Option 1: Can I create an intermediate
2007 Nov 25
4
is notify resevered word?
Hi,
When I added this association...
class User < ActiveRecord::Base
has_one :notify
end
...and tried then to update column in User table it will call queries
for notify table automatic?
Output
---------------------------------------------------------------
User Columns (0.041488) SHOW FIELDS FROM `users`
User Load (0.001544) SELECT * FROM `users` WHERE (`users`.`nickname`
=
2007 Nov 01
3
autotest debugger?
Hi,
I keep facing problems with autotest, and I don''t know what''s happening
in the background, is there anyway to know what''s happening while
testing?
Example:
@user = User.new
@user.email = "testcom"
@user.errors.on(:email).should_not be_empty
...throws error failure
- You have a nil object when you didn''t expect it!
- You might have expected an
2006 Jun 01
9
access model from controller
Hello,
Rather new to RoR, so I''m not sure about the terminology and such :-/ .
My question is: how could I know the model which is associated to a
controller?
For example:
- controller class is TestController, which is a subclass of
ApplicationController
- associated model class is Test
How could I write some code in a method of ApplicationController to
dermine the current
2007 May 06
2
render :action "call method first?"
Hi,
I know when I call:
render :controller => ''some'', :action => ''thing''
It doesn''t call the method ''thing'' before render the template
''thing.rhtml'', but I need some instance variable which are in the
''thing'' method, how can I let it call the method ''thing'' and then render
2007 Mar 27
6
how does rails do this "find_by_?"
Hello there,
I''m wondering how do they create functions on the fly?
find_by_any_column_name ??
I want to do something similar with my models, but I don''t really know
how to do it?
user_current_nickname
user_current_id
user_current_role
etc.?
Regards,
Jamal
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this
2008 Aug 15
7
Autotest and subclasses / namespaces
I am writing a controller admin/cities_controller.rb
it inherits from AdminController, so it''s defined like
class Admin::CitiesController > AdminController
Whenever I save the controller file, autotest freaks out:
uninitialized constant Admin::AdminController (NameError)
I''m pretty used to just hitting CTRL-C to get autotest to re-load all
the files, or flicking to
2011 May 06
3
Rails 3 Routing problems
I have an UploadsController and UsersController where Users''
has_many :uploads'' via polymorphic attachment in uploads.rb.
Now we i navigate to http://localhost:3000/users/1/uploads
I get re-routed to Uploads#index and rendered is called multiple times
as shown below:
Started GET "/users/1/uploads" for 127.0.0.1 at 2011-05-06 22:00:38
+0100
Processing by
2007 Oct 02
3
Note on Rails 2.0 Preview
Make sure you get a relatively current version of rspec or you will get:
/Users/me/rails/ubb/vendor/rails/activerecord/lib/../../activesupport/
lib/active_support/dependencies.rb:263:in `load_missing_constant'':
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
(NameError)
Hope this helps someone.
2007 Sep 07
5
enforce mutual exclusivity
Hi,
First post, please be gentle! I couldn''t find any mention of this
already
I''m using ActiveRecord and I want to enforce mutual exclusivity on a
has_and_belongs_to_many.
A concrete example: I have a User which can have one or more Roles
(student, tutor, headmaster, administrator etc). However if a user is
a
student they cannot hold any other role. I was hoping to find
2011 Apr 21
1
Rails 3 Foreign Domain routing - cannot get this to work!
Hello,
I''m trying to build an app (mysuperapp.com) that allows users to create
an account in which a default subdomain (IE: joeshmoe.mysuperapp.com) will
be
created as their homepage. In their profile settings, I also want to give
them the ability to add their own domain name so their homepage now can be
joeshmoe.com. I know this is possible in rails w/ plugins like
subdomainfu
2011 Apr 06
1
Time to fix PartialRenderer#partial_path
For the longest time PartialRenderer#partial_path has prefixed the
prefix of the current controller when it is nested in a module. This
hasn''t been a problem (because nesting controllers wasn''t that common)
but with 3.1 striving for better engine support, this problem is now
larger because all of your controllers for an engine will be nested
and it makes doing <%= render
2007 Apr 12
4
Installing rspec in Windows
Hi all,
I''m trying to install rspec and I''m having a problem.
C:\Users\Nathan\Documents\rails\myproject> gem install rspec
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rspec-0.8.2
Installing ri documentation for rspec-0.8.2...
Installing RDoc documentation for rspec-0.8.2...
C:\Users\Nathan\Documents\rails\myproject> ruby
2007 Mar 29
4
validates_length_of not working with :if ?
Hello,
I''m trying to cut down the errors if the guy already getting the empty
nickname, so he doesn''t get anything about the nickname is short.
validates_presence_of :nickname
This below is not working ?
validates_length_of :nickname, :within => 4..40, :if => Proc.new {
|user| user.nickname.length > 1 }
nor this one below?
validates_length_of :nickname, :within
2007 Mar 01
1
RoR: Torrent Tracker
Hello their,
I managed to find torrent tracker made in RoR language, now I downloaded
and trying to run it, but I get error saying:
Could not find RubyGem bencode (>= 0.0.0)
I don''t know where i can get the bencode, anyone can help please :)
require_gem ''bencode''
regards,
Jamal
--
Posted via http://www.ruby-forum.com/.
2009 Mar 26
3
Using same variable in controller
Hi guys! More question :P~
OK, I''m following a tutorial for rail, and I got this new.html.erb in
views, and in order for a form to be showed up correctly without error,
I had to add this small snippet of code in the controller under method
"def new".
class AdsController < ApplicationController
2 def show
3 @ad = Ad.find(params[:id])
4 end
5
6 def index