Displaying 20 results from an estimated 1000 matches similar to: "Having problems with edge rails"
2006 Nov 04
3
role based authorization question
I am using the the authorization recipe outlined in Rails Recipes.Is it
possible for one role, say ''admin'', to have access to every action on every
controller without explicitly having to create a Right for each?
I know this will not work as is, and to force it to do so would violate MVC,
but is there some other way to accomplish having something like this in a
controller:
2007 Jan 21
0
Functional Test Fails with before filter in application.rb
Hi There,
I am trying to write my first tests for a role bassed authentication
taken from Rails Recipies. Whenever I add:
assert_redirected_to :action => ''login''
I get the following error:
NoMethodError: undefined method `first'' for :user:Symbol
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/assertions/response_assertions.rb:72:in
2006 May 11
3
can''t call link_to from within a model class
can anyone tell me how to call link_to from within a model class? I''m
trying to do something like the following:
validates_uniqueness_of :email, :message => "address has already
been taken. If you''ve forgotten your password, please click " +
link_to(''here'', :action => ''forgot_password'', :controller =>
2006 Feb 20
2
file_column: changing default store_dir
File_column plugin is great. I need to change the default :store_dir
from the dynamic "model_name/attribute_name" to an equally dynamic
"client_id/app_id/model_name/attribute_name". In my model I have:
class Component < ActiveRecord::Base
belongs_to :component_type
belongs_to :component_group
breakpoint
file_column :content,
:magick => { :versions
2006 May 16
2
before_filter and the application controller
Hi there,
I''m having a bit of an issue with my before_filter. I know that the filters
put in the application.rb controller are global for all the controllers. In
my application filter I''d like to allow access to the RSS feed method in a
''member'' controller and skip the login checks that the before_filters are
currently performing.
In my application my filters
2006 Aug 14
3
validating required fields during an update?
I have a User model with an email attribute. I''m using the following
validations:
validates_confirmation_of :email
validates_format_of :email,
:with => RFC822::EmailAddress,
:message => "must be a valid address in the form user@domain.com"
validates_uniqueness_of :email, :message => "address has already
been taken. If you''ve forgotten your
2006 Apr 27
7
Role Based Authorization recipe implementation?
i got the rails recipes book, i have now an auth system for users
without problems, now i want to made a role based acces for my app, im
following the "Role Based Authorization" recipe of the book but i cant
make it to work even when the tables created and correctly added data
manually definig the roles and rights. als i dont know how to define a
right for use all the actions in a
2006 Nov 04
0
Problem with edge rails, controller namespaces and routes
I just upgraded to edge rails so I can use the BigDecimal support for
monetary calculations. I''ve just come across the following problem..
Right now, I''ve got a content controller which is responsible for
updating much of my site''s content. I''ve decided to make this a
subclass of Admin, so I can organize my administrative related
controllers into their own
2006 May 19
0
No luck with multiple before_filters
I''ve got these two lines set up in my controller
before_filter :check_authentication
before_filter :check_max_hands, :only => [ :play ]
Here''s the corresponding code for each
def check_authentication
unless session[:user] and authorize?(session[:user])
session[:intended_action] = request.request_uri
redirect_to :controller => ''user'',
2008 Jun 11
1
Resourse route in namespace with prefix error
Ok so I have this route
map.namespace :trades do |trades|
trades.resources :buys, :path_prefix => ''/trades/:contract_id''
end
I want the contract_id variable to filter a list of buys
then I try to open this route http://localhost:3000/trades/1/buys
I get a strange error:
ActionController::RoutingError in Trades/buys#index
Showing trades/buys/index.html.erb where line
2006 Mar 31
6
BigDecimal + Float => Float?
I was just playing around in irb and noticed that while BigDecimal + Integer
=> BigDecimal, BigDecimal + Float => Float. Is there any reason for this?
It seems inconsistent and means you have to check the class of any number you
add to a BigDecimal, which looks very un-Ruby-like to me.
Ashley
2006 Mar 29
0
Bug with skip_before_filter?
There seems to be a bug with skip_before_filter using the :only or
:except conditionals.
Or am I using them completely wrong?
I have this code:
The result is that :test_filter is skipped for both index, and
index_no_filter.
application.rb
# Filters added to this controller will be run for all controllers in
the application.
# Likewise, all the methods added will be available for all
2007 Nov 13
4
question about activerecord test_numeric_fields in base_test.rb
There''s a test for activerecord called test_numeric_fields in
base_test.rb. here''s the test
def test_numeric_fields
m = NumericData.new(
:bank_balance => 1586.43,
:big_bank_balance => BigDecimal("1000234000567.95"),
:world_population => 6000000000,
:my_house_population => 3
)
assert m.save
m1 =
2006 Apr 21
1
Catch authentication result from a model in a controller
Im still following the authorization recipe from the book, now all works
fine but im getting trouble in how handle the model authorization
result, if the user and pass are correct, it goes to a welcome
screen(admin.rhtml) but if wrong the model prints a message in an ugly
exception like page "usr and pass not correct", i want to redirect the
user to the login
2008 Jan 11
0
trouble skipping before filter in controller
Hello,
In my application I want several before filters to apply to every
request except for login and authenticate. So in my application
controller I have
before_filter :setup_user, :check_for_duplicate_user, :update_timestamp, :kick_if_inactive
then in my user controller which contains the login and authenticate
actions i have
skip_before_filter :setup_user, :only => [:login,
2006 Apr 25
0
completely stuck on Role-Based Authorization
Im completely stuck on Role-Based Authorization (I used the rails recipe
method)
(user_controller.rb)
def login
return if generate_blank
@user = User.new(@params[''user''])
if @session[''user''] = User.authenticate(@params[''user''][''login''],
@params[''user''][''password''])
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I
2009 Oct 07
1
output validations errors form causing type error?
Hi,
I was wondering if it is possible to output validation errors in a
nested form? I suppose this should be possible, but I am experiencing
an error message that I can''t track down.
The error I get is the following :
TypeError in Store/orders#create
Showing app/views/store/orders/new.html.erb where line #45 raised:
can''t convert Array into String
This is ocurring in the
2006 Jun 30
8
before_filter: nil vs. true vs. false
Folks,
My understanding of how filters work is that I should return true if
everything is ok and false if not. How does the filter below work
then (from the Rails Recipies book)?
It would return nil if there''s a user in the session. Does nil count
as true?
before_filter :check_authentication
def check_authentication
unless session[:user]
session[:intended_action] =
2006 Dec 01
0
You are being redirected message
Ticket #3082 details a fix to add a body to redirect pages. This seems like
an old patch, but only now is it biting me. I have an authentication scheme
like this:
class ApplicationController < ActionController::Base
before_filter :check_authentication, :except => [:signin]
def check_authentication
return true if session[:user]
session[:return_to] = request.request_uri if