similar to: syntax error, unexpected tSTRING_BEG

Displaying 20 results from an estimated 2000 matches similar to: "syntax error, unexpected tSTRING_BEG"

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 Apr 24
5
Custom pagination
I am trying to paginate objects from a has_many/:through relationship using Paginator. current_user.things returns the objects that I''d like to paginate. For testing, I tried to make it 1 item per page. I initialise the paginator as follows: @thing_pages = Paginator.new(self, current_user.things.count, 1, @params[''page'']) I don''t know how to obtain
2006 Aug 16
3
calculate method is gone once I use ''find''?
Could someone please explain why this works: current_user.accounts.sum(:balance) But not this: current_user.accounts.find_all_by_active(true).sum(:balance) For the latter Rails tells me sum is an undefined method. It seems like I lose the ActiveRecord methods when I call ''find''? This (simpler) does not work either: current_user.accounts.find_all.sum(:balance) Thanks! --
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 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
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)
2007 Nov 13
2
More Rails Pattern Examples?
Hi, I have been reading the documentation and examples on the rspec site. There are two "patterns" from Rails that I am not clear how to implement that are kind of related, and so I am not sure how to start. Does anyone have any examples of how to write rspecs for these? 1/ Nested resources. 2/ Resources that are specific to the current_user. In other words, I only want to
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
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.
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
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
2008 Nov 03
1
Questions about changes to Restful Authentication.
I have a couple of projects with Restful Authentication The first snippet is from the Git repo today and is supposed to be the newer code. # Store the given user id in the session. def current_user=(new_user) session[:user_id] = new_user ? new_user.id : nil @current_user = new_user || false end # Store the given user id in the session. def current_user=(new_user)
2006 Aug 15
2
Working with user data
I am a Rails newbie and I am trying to build a test site in which users will have their own sets of data. I understand how to manipulate shared data very well. Most of the Rails examples out there seem to deal with such shared data. I am struggling with the "best practice" method for a user to work with their own data however (and not be able to view/edit other users''
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
2010 Apr 02
6
App_Controller and partial issues with has_many through
I have a User model, a Post model, and an Interest model: User has_many posts through interests User has_many interests, dependent destroy Post has_many users through interests has_many interests, dependent destroy Post has_many interests Interest belongs to Post Interest belongs to User Application_Controller is as follows: class ApplicationController < ActionController::Base before_filter
2006 Jul 16
9
acl_system help is needed
i found Ezra''s acl_system plugin yesterday and i am trying to figure it out. based on the simple instructions on the site, it does exactly what i need but i''m getting some errors when i try to use it: NoMethodError in UsersController#index You have a nil object when you didn''t expect it! The error occured while evaluating nil.roles i am pretty new to rails and
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m seeing something I''ve never seen in RSpec before: the same test run twice fails on the second one. I am NOT doing before(:all) or other things that should cause state to persist between tests: Here''s the relevant code: context "POST create" do context "with user logged
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 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,
2008 Jun 15
7
Getting "no block given" on find method - rails 2.1
I am trying to do a simple find through the current_user but get an exception. Either someone spiked my Starbucks coffee and I am screwing up all over the place or there is something wrong. def index @league = current_user.leagues.find(13) end # Error LocalJumpError in Admin/schedule todosController#index no block given If I pass a block to it it works fine, but it is just messy: =====