Displaying 20 results from an estimated 400 matches similar to: "undefined method `redirect_to''"
2010 Oct 03
4
USB boot: No DEFAULT or UI configuration directive found!
Hi, friends
It is described at this page:
http://superuser.com/questions/195275/usb-boot-no-default-or-ui-configuration-directive-found
<http://superuser.com/questions/195275/usb-boot-no-default-or-ui-configuration-directive-found>help,
thanks!
--
regards
chenge
2006 Jun 22
4
Filter on variable
Hi all,
I have a question about filtering on a variable.
If I have the following code in my controller to select a list of
users
> @allusers = User.find(:all,
> :conditions => [''team_id = ?'', @params["id"],
> :order => ''created_at'')
Is there an easy way to find out all users who
2006 Dec 05
1
Using render inside a FormBuilder (EdgeRails)
I''m using the latest trunk of 1.2-ish, and I''m wondering how to do what
I want to do. I am using a form_for :builder I wrote, simply called
TableFormBuilder after the rails cookbook, and want to be able to
present help icons automatically. I want these icons to appear next to
form fields I am rendering.
For example, I have this method in helpers/table_form_builder.rb:
# This
2009 Jun 05
6
rails 2.3.2
Hi all,
I am using rails v.2.3.2 and if I put following line to my
ApplicationController:
include LoginSystem
and I moved my login_system.rb to lib folder:
module LoginSystem
protected
def is_logged_in?
@logged_in_user = User.find(session[:user]) if session[:user]
end
def logged_in_user
return @logged_in_user if is_logged_in?
end
def logged_in_user=(user)
if
2008 Nov 10
3
to_xml and helper methods
Hi,
I have an array with objects and I want to generate an XML like:
<objects>
<object>
<category_id>1</category_id>
<helper-method>result 1</helper-method>
</object>
<object>
<category_id>2</category_id>
<helper-method>result 2</helper-method>
</object>
</objects>
The helper
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that
my users can have multiple roles.
("Admin" role does always have id = 1).
I have added these methods to my application controller.
<code>
helper_method :is_admin?
helper_method :is_user?
def is_admin?
if @session[''user'']
@session[''user''].roles.find(1)
2008 Jun 13
3
before_filter order of execution
Hi
I''m trying to use before_filter to allow access to a site. Only logged
in users can view any object in the controller, but only users with a
access_level higher than 2 can view specific objects. My code is:
-----------------------------------------------------------
IN USER_CONTROLLER
before_filter :login_required
before_filter :access_granted, :only => [:destroy, :new , :edit]
2006 Jun 27
6
embedding ruby code in a [flash :notice]
The ruby code in this isn''t evaluated...
flash[:notice] = "Your last recorded entry was <%= @in_out.time_in %>
<br />You are currently marked as ''In'', you probably want to check
''Out''"
Is there a way?
Craig
2006 Jun 24
7
Newbie Q: "user" variable in every view?
Newbie to RoR -- as a long time Java Struts/etc. guy it is an awesome tool!
I have implemented some basic login/session stuff with the help of a great
tutorial, props to the author (
http://www.aidanf.net/rails_user_authentication_tutorial).
I have a trivial instance method in ApplicationController, which just grabs
the User object from the session.
def current_user
session[:user]
end
2006 Jun 27
5
Can''t call public application.rb method from ERb template
All,
I have a left navigation partial that I want to dynamically generate CSS
classes for based on the current controller action.
In my ERb template, I have
<DIV class="<%= get_menu_display_style(''login_form'') %>">
In application.rb, I have the method get_menu_display_style defined as:
public
def get_menu_display_style(action_requested)
2007 Dec 05
4
render :update and controller private methods
Probably asked and answered, but...
Why are controller private methods inaccessible inside the block
passed to render :update ?
This does not work:
class MyController < ApplicationController
def some_action
render :update do |page|
page.replace_html ''an_element'', some_private_method
end
end
private
def some_private_method
return
2011 Jun 09
8
Fail to call
Hi, I''m trying create a user system for a future project but I have a
problem when I want give to my users the "Welcome". This is my code:
#application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
2011 Apr 05
4
Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
Hello,
I recently updated Rails to 3.0.5. The very same code that worked on
3.0.3 now gives error.
The code is:
def kategorialista
Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s|
[s.nev, s.sefuri]}
end
It is in application_controller.rb with
helper_method :kategorialista
The error it gives on 3.0.5:
SQLite3::SQLException: no such table: kategoria: SELECT
2006 May 02
1
Sharing function between helper and controller
Hi,
I have a utility function repeated in both my helper and my
controller. Not DRY. I have this repetition because other functions
in the helper and in the controller both use the utility function.
Where do I put this function so that both the helper and controller
can access the function? Mayber there is a different solution?
Thanks,
Peter
2006 May 08
3
MVC newbie question
All,
Is it possible for a view to call back to a controller method? If so,
what is the syntax?
=== details
I have a list view that I want to filter out inactive rows based on
several table fields being zero, old, etc.
It would seem I should create a "filtered" method in the controller
(which I have done).
Then invoke if from the view like:
for row in @rows
continue if row.filtered
2005 Dec 19
1
Application.rb / Application_Helper.rb / DRY help
Hi all,
I have defined the following method in both application.rb and
application_helper.rb:
def still_logged_in?
!session[:user_id].nil?
end
This method is called in a before_filter in my application.rb, as well
as in my layout/application.rhtml and view/user/login.rhtml (for
showing a login / logout button, etc.)
I had to put it both places, otherwise I would get an
2005 Dec 19
3
Where to put code - app controller, or app helper?
I have a function i want to be used in both views and controllers:
def year_to_fiscal_year(year)
# converts, say, an integer 2003 into ''0304''
year.to_s[2,2] << (year+1).to_s[2,2]
end
Where should i put it ?
--
Posted via http://www.ruby-forum.com/.
2005 Oct 12
1
Global helper method?
I want a method to be accessible from everywhere in my app (it''s a Gaussian
RNG) - I''ve already put them as protected methods in application.rb but that
would only allow them to be accessed from controllers.
I have a method in a model that needs access to this too, and I''d prefer not
performing the calculations outside the model. Copying the method definition
into the
2009 Oct 18
4
NoMethodError in User sessionsController#new
I''m setting up authentication with Authlogic and I get this error.
I''ve done some searching but with no success. I tried setting the
current_user method in Application_controller to protected and not
private, on the recommendation in Stack Overflow.
Error in browser-----------------
NoMethodError in User sessionsController#new
undefined method `require_no_user'' for
2006 Jul 25
6
form and pagination question
Hello,
How do I get params from a form to use with a paginator?
debug(params) shows this
city: !map:HashWithIndifferentAccess
id: "1"
but in my controller, when I try to use
@hotel_pages = Paginator.new self, Hotel.count(:conditions =>
"hotels.city_id = params[:city][:id]"), 3, @params[''page'']
it doesn''t work. I suppose it''s a simple