Displaying 20 results from an estimated 11000 matches similar to: "Questions about changes to Restful Authentication."
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi,
I just installed Rails 2.0.2
[root@mymachine easyx]# ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
[root@mymachine easyrx]# gem install rails --include-dependencies
Need to update 16 gems from http://gems.rubyforge.org
................
complete
Successfully installed rails-2.0.2
[root@remandev easyrx]#
But I''m getting this error in my restful_authentication
2006 May 07
1
Overwriting setters for associated objects
Hi all,
I''m trying to overwrite a setter method, but am running into some
difficulties. This is normally really easy when overwriting a setter for
a table column, but in this case it is the setter for an associated
object.
Here''s a hypothetical example:
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
2006 Mar 16
1
beginner question on active record relationships
say I have the following:
# user table
# - id
# - username
# - password
class User < ActiveRecord::Base
has_many :items
end
# item table
# - id
# - user_id
# - name
class Item < ActiveRecord::Base
belongs_to :user
end
What is the correct way for creating a new item instance with
relationships in place (assuming the current user is available in the
current_user instance)? Do you
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem:
Mock ''Task_1005'' received unexpected message :user_id= with (1)
No matter what I do to try to stub that out it will still fail out and give
me that message.
Here is my spec
describe TasksController, "handling POST /tasks" do
before(:each) do
@task = mock_model(Task, :to_param => "1", :save => true)
2010 Nov 20
6
syntax error, unexpected tSTRING_BEG
Rails is throwing this error
C:/Ruby/Depot/app/views/products/index.html.erb:28: syntax error,
unexpected tSTRING_BEG, expecting keyword_do or ''{'' or ''(''
...er.privilege == 50 ? {link_to ''Show'', product} : ''a'' );@out...
in line
<%= current_user.privilege == 50 ? {link_to ''Show'', product} :
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in
my application rhtml:
before_filter :login_required
around_filter :set_timezone
around_filter :catch_errors
Currently I have them commented out while rspec''in but I''ll need to add them
in my specs.
def create
@ticket = Ticket.new(params[:ticket])
@ticket.user = current_user
if
2006 Mar 02
3
Modifying "Find" to always add a condition?
I''d like to always add a condition to any version of "find" (e.g.
Thing.find(), Thing.find_by_name(), Thing.find_by_whatever) so that in
addition to whatever conditions are set, an additional condition is set
:conditions=>"user_id=#{current_user.id}"
I''d like to make sure that a user only sees/edits/creates entries in the
database that have the user_id
2012 Mar 09
2
ActionMailer message delivery content
I have the ability to send email to a user if a certain user has
requested interest in their product. In my email I want to include
certain information that is pulled from users but at the moment I am
getting errors because it states that they are undefined despite these
lines being used elsewhere in my application. I shall copy the email
below and anything between the <% %> is what I wish
2012 Apr 10
6
User Association
Please Im trying to create an application where i can post like twitter,
but i was the users name to be posted under their respective posts
My Post_controller looks like this
def index
@posts = Post.all(:order => "created_at DESC")
@users = User.find(:all)
#@user_id = current_user.find(params[:id])
respond_to do |format|
format.html
end
end
def create
2007 Aug 23
3
recording current_user
Hi,
Another noob here I am afraid! I have a questuin about the current_user
method that comes with AAA.
I have AAA set up and working fine and if i put <%=
self.current_user.login %> into a view it shows the login name as
expected on the page.
What I cant work out is how to record this into the database when the
user completes a form.
My app so far only has two models.
2006 Jun 02
6
Set instance variable for all actions in the Controller
Can I set an application wide instance variable that is available for all
actions...and their views?
eg.
class ApplicationController < ActionController::Base
@current_user = User.find(session[:user_id])
end
and everywhere I can call @current_user.id and I can get that object? Even
down in the views?
I could not get this to work...
Thanks in advance,
Jeff
-------------- next part
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all,
After many days of struggling, I have a multi-model form with ajax
elements more or less working, but I''m hitting a wall with a few bugs
that I can''t figure out. Guidance would be very much appreciated.
I''m using the Ryan Bates technique from Advanced Rails recipes to
dynamically add and remove elements on a multi-model form.
2011 Sep 27
2
passwd problem with new vps
greetings,
I am setting up Centos 6 i686 remotely, on a new VPS.
A problem I have is that I cannot set password for new users. I have
created one with
useradd -m new_user
but when I type
passwd new_user
this is the result:
[root at vps ~]# passwd new_user
Changing password for user new_user
New password:
Retype new password:
passwd: Authentication token manipulation error
[root at vps
2007 Jun 04
1
acts_as_rateable in Beast
I''m trying to implement acts_as_rateable to my Beast installation to
give users the option to rate posts (like reddit). I chose
acts_as_rateable as it supposedly easily allows reddit-type voting but
I''m having some problems setting it up and the documentation seems
outdated.
(http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/)
So far, I''ve
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi,
Just wondering when one would use "include" over "extend"? Both seem to
bring in methods to the class no?
The context is I''m just trying to understand why both are used with the
acts_as_audited plugin:
Full extract from plugin (used within here):
==================================================
# Copyright (c) 2006 Brandon Keepers
#
# Permission is hereby
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task
for a given user.
>From a controller, I imagine something like:
def start_job
MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task,
:data => { :user_id = current_user.id })
end
def check_job
@status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id]
end
2006 Jun 09
1
finder_sql issue with has_many :through
I have an inner join query that Action Record can''t seem to pull off
conventionally, so I''m trying to use :finder_sql to utilize an sql query
that works beautifully in SQL. The problem is, when I try to call the
method, I get the following:
private method `gsub'' called for #<Array:0x267de04>
Here is my has_many code:
has_many :mod_privileges,
2006 Mar 23
2
Question About Scaffolding for My First Rails App
When using ruby to generate scaffolding, is there an easy way to add
features that would be useful for keeping track of has_many and
belongs_to relations? For example, suppose I have the following:
Users
Sites
Pages
Modules
Each user has many pages, each site has many pages, each page has many
modules, and also the belongs_to relation holds in the opposite order.
I''m using the
2010 Feb 16
0
Strange routing(?) Issue
I have a Model event and the following two lines in routes.rb
1 - map.connect "events/:action", :controller => ''events'', :action => /
[a-z_]+/i
2 - map.resources :events, :has_many => :comments, :has_one
=> :address #, :collection => {:mapit => :get}
I have #1 so that I can call custom actions from a link_to_remote link
from my index page t0 update a
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
I''ve got User has_one Shop. Rails is not validating when I tried
create_shop or build_shop, neither in the browser nor the rails console.
My code:
class Shop < ActiveRecord::Base
attr_protected :user_id
belongs_to :user
validates_presence_of :name, :primary_address, :city, :country_code,
:currency
end
class ShopsController < ApplicationController
before_filter