similar to: Issue with session variables

Displaying 20 results from an estimated 4000 matches similar to: "Issue with session variables"

2006 Mar 04
7
Get ID after save
This is simple (I am sure) but how do you get the id of the inserted element after the element has been save? I thought it was something like this: @product = Product.new(params[:product] if @product.save add_image(product.id, params["image"]) flash[:notice] = ''Product was successfully created.'' redirect_to :action => ''list_products'' end
2006 Feb 17
4
Why doesn''t this work!
I have this in my controller... @tech_standards = TechStandard.find_by_sql("SELECT * FROM tech_standards WHERE subpoint <> 0") Everything is fine except when I look at my view I still get supoints that are 0. When I run this query in my query browser I don''t. View: <select name="resource[tech_standard]" id="tech_standard">
2006 Feb 21
7
Validation issues
I have a form. Everything submits into the database if I don''t have any validation rules. When I put these rules: validates_uniqueness_of :title, :message => "already exists in database" validates_presence_of :title I get this error (which seems weird because I am not validating against that): You have a nil object when you didn''t expect it! You
2006 Mar 01
2
Help with Many-To-Many insert
I am having issues with a many-to-many table. The table relates resources to standards, but in my resources table has one-to-many relationships so those also appear in my many-to-many table. I am trying to insert into the table via: @resource.core_contents << CoreContent.find(params[:core_content_ids]) But I get this error: Mysql::Error: Duplicate entry
2006 Mar 16
3
ACLSystem and session variables
I am using the ACL System that is described on the Rails wiki and I have a quick question. I want to set the "role" as a session variable so that I can display certain navigation schemes and I was doing it like this: @session[:user][:role] = @user.roles When I print out this variable I get: #<Role:0x3262d80> How can I turn this into a readable value? I tried .to_i
2006 Jan 05
2
help - edit without using scaffold
Hello, What am I doing wrong? The code below does not show the current record for editing. def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(params[:user]) flash[:notice] = ''User was successfully updated.'' redirect_to :action => ''show'', :id => @user else render :action
2006 May 30
4
Hide parent element
I have some code that calls a partial to display one or more blocks within a div tag. I want to have a close button (or cancel link) that will fade that block but leave the others. Here is the code: LINK: <%= link_to_remote "Add Miscellaneous Link", :url => { :action => :add_iyc_link } %> add_iyc_link.rjs: page.insert_html :bottom, ''links'', :partial
2006 Feb 05
8
Agile Rails book: depot problem 2
My second problem is: Listing users, and deleting them doesn''t work. If I try to list user, i just get this list: User Delete User Delete User Delete User Delete I''m using this code in the login_controller: def list_users @all_users = User.find(:all) end def delete_user @id = params[:id] if id && user = User.find(id) begin User.destroy
2006 Feb 21
4
Error, got String?
I am getting this error. ActiveRecord::AssociationTypeMismatch in Resources#create Focus expected, got String I have a select menu named resource[focus]. My focus (belongs_to :resources) table has a one-to-many relationship with the resources (has_one :focus) table (A resource will have only one focus but one focus will have many resources). I assume this error means that the focus is
2006 Apr 10
2
Fix log files
What is the code I include in one of my files so that my log files are easier to read? I am using Windows. Thanks. Seth -- Posted via http://www.ruby-forum.com/.
2006 Mar 10
3
installing rails 1.0 on Windows
I ran the gem installer and it seemed to work, but i believe i''m still using an older version. How can i tell what version I''m really using? Thansk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060310/435006b0/attachment.html
2006 Mar 17
7
OT: Subversion folder cleanup
How do you clean up your app folder to place onto the server? I want to get rid of all the .svn stuff. Seth Buntin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060317/cc81d9f7/attachment.html
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
2007 Dec 09
4
Help on drying code
Hi all, Currently I''m having to do this: def self.authorized_roles(controller, action) specific = self.find_by_controller_and_action(controller, action) all_actions = self.find_by_controller_and_action(controller, ''*'') all_controllers = self.find_by_controller(''*'') role_ids = [] specific.each do |role_item| role_ids <<
2008 Apr 03
2
Change the value stored in inheritance_column
I have been struggling for quite sometime with this. Is there any way to configure the Model to store user defined value in the inheritance_column instead of the default value (which is class_name) The problem I have is like this: I have a User model and there are different models which inherit from this like Admin, Premium, Professional, etc. Each of these inherited models are identified by a
2006 May 04
7
windows / migration issues
Running latest rails, etc on windows xp. I can''t use "rake migrate" to migrate to latest version. I NEED to specify, i.e. "rake migrate VERSION=11" for things to work consistently. plain ''ol "rake migrate" never makes it to the latest version. no errors, she just stops short of the latest version. hasn''t been a problem until now --
2006 Aug 07
0
question/problem with habtm and "include?"
I have what I feel is a standard habtm association to manage user/roles/permissions. However, I''m having a small problem wondering why ".include?" isn''t working like I thought it should. I''m attempting to use this to determine whether a user has access to a particular permission: if session[:user].role.permissions.include?(''Lead List'')
2006 Sep 05
0
rake craziness with Migrate as a dependency
Hi everyone, For one of our projects we have a need to deploy and maintain a demo. As a result I''ve attempted to setup a set of rake tasks for the job. My goal is have one rake task called "deploy_demo" which purges the database, migrates to the current schema, and loads the db from a set of fixture files in a specified location. I''ve written two new tasks the perform
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
2016 Jun 09
0
wbinfo -u and -g gives no output
>Note: the line 'idmap config ad' is not a correct samba option. >But also this would not cause your issue. I did not config this and I believe this comes from the default. Do you suggest to comment this out? I tried "wbinfo -u" and "wbinfo -g" again and attached the log.wb-CFS file. Sorry I forgot to mention, I did stop winbind, remove