Displaying 20 results from an estimated 10000 matches similar to: "setting a session variable, :value and :session_path"
2006 Aug 03
0
Setting session variables and expiration issue.
Hello,
I''m having some difficulty with using sessions. Basically, I''d like to
be able to store a hash in an action:
def action
session[:details] = {:value => some_hash, :session_path => "/main"}
end
I''d like to be able to retrieve the hash in another action under the
same "main" controller. I retrieve it by doing the following:
def
2008 Feb 09
1
how to check the config.action_controller.session options ?
when setting it in my environment.rb
config.action_controller.session = {
:session_key => ''_myapp_session'',
:secret => ''3a64394bb895f1f05e0c07f71127d93d''
}
I cannot get it back in the script/console ..
:session_key=>"_session_id" !!!
why ?
>> ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
=>
2006 Apr 13
2
Dynamic finder conditions
Hi everyone,
I''ve been working on some code which will take params and turn them into a
WHERE clause for the :conditions option in finder methods. So far I''ve been
able to do some very simple text matching. I''d like to be able to support
ranges, and then go from there (in fact I''ve added code for date ranges but
I''m embarrassed of it so I
2006 Apr 16
3
variable variables?
Hi everyone,
Does Ruby support variable variables like PHP
(http://www.php.net/manual/en/language.variables.variable.php)? Or do I have
to use eval, like
some_hash.each_pair{|key, pair|
eval "#{key} = #{value}"
}
Or is there some other way?
I''m actually trying to figure this out in order to use ez_where to create
its conditions from a hash, so if this isn''t even
2006 Apr 03
3
render :partial + redirect_to :controller
This is of course disallowed, which I discovered only after nearly
completing my spanking new ajaxified UI. What is the motivation behind
this, and what is the best workaround?
This UI does a scriptaculous drag-and-drop of items from a first div
(div1) over to a second div (div2), which triggers the contents of div2
to be updated to reflect the drop. No prob, thus far. But then the
2006 Apr 29
11
Multiple actions from one form - possible?
Hello *
Obviously the rhtml below does not work, but it should be apparent what
I try to achieve - I would like to give the user the choice to submit a
form either to action1 or action2 but I cannot figure out how?! It would
be great if someone could give some assistance.
Thanks a lot, Alex
<%= start_form_tag :action1 => ''save'', :action2 =>
2006 Apr 24
3
TimeStamp conversion
Hi,
I''ve got a TimeStamp field in MySql and want to use the hour and minutes
in the value.
for example:
StartTime = Schedule.find(action2.ScheduleID).DateTimeStart.to_s
That returns "Mon Feb 20 08:00:00 Romance Standard Time 2006"
How do I get 08:00 returned ??
Thanks !
Steven.
--
Posted via http://www.ruby-forum.com/.
2006 May 23
4
''key not found'' problem with saving model object.
Hello,
I have the following structure:
model foo
has_many :bars:,
:dependent => true
end
model bar
belongs_to :foo
end
In my action, when i try to save foo:
def save
begin
f = foo.new
f.a = 5
begin
b = bar.new
b.a = 10
f.bars << b
rescue Exception => exc
...
end
f.save! <-- This does not happen
2006 Jul 28
2
passing a variable from controller to model
Hi,
How do I pass a variable from my action into a model before saving the
model. I''d like the model instance to have access to this variable to
do some work before saving the model instance but the variable is not
part of the model itself.
Thanks,
Sam
--
Posted via http://www.ruby-forum.com/.
2006 May 16
4
question about strftime when called from partial.
Hi,
I''m calling a helper I''ve written - format_time() that is called from my
views with a given time that was selected from my database and was returned
to the view via an instance variable. When I call format_time from a
partial, I see that I get some kind of String error and the partial won''t
render. Basically, the object being passed in to format_time is already a
2006 Jul 11
1
Aggregate Controllers
Hi,
I''m developing a dashboard like page and basically want to combine the result of multiple actions on a page. I''ve done this so far:
def index
r1 = render_to_string :action => "action1"
r2 = render_to_string :action => "action2"
render :text => r1+r2
end
This works, but now I want to render from other controllers and this is where
2006 Apr 03
1
Best way to set custom Controller options
Hi All!
I''m searching a good way to set some options in my Controllers; I tried
defining a custom function, ie:
class PeopleController < ApplicationController
set_my_actions :action1, :action2
end
class ApplicationController
def self.set_my_actions(*args)
@@my_actions = args
end
end
But ''@@my_actions'' sets the class variable to _every_
2006 Apr 10
3
form_remote_tag can only have one submit button?
I setup a form_remote_tag with several submit buttons, all of them share
the same name
( ''do_action'' ) and their values differ.
eg.
button1 named do_action with value ACTION1
button2 named do_action with value ACTION2,
etc
No matter which button I press the value passed is always the one
defined for the first of these buttons ( the correct value associated
with the pressed
2009 Mar 05
4
before_filter :action_name OR :action_name
Hi there
I am wondering if we can use before_filter in the form of :action
OR :action
what i want to do is to implement one of the actions, if the first
failed, then go to the second
when i use
before_filter :action1
before_filter :action2
each method will run them, my case is that i want to check if one of
them is true and not both
any idea?
2006 May 10
0
Boolean attributes - not so simple as I thought
Suppose I have a table ''items'' with the attribute ''bool'' which is
boolean.
There''s an array @attribs which holds :bool and some other symbols of
attributes which are not boolean.
class Item < ActiveRecord::Base
{
def attribs
[:bool , :x , :y]
end
}
The trouble is that @item.bool? and @item.bool behave differently.
If I set @item.bool=5
2006 May 30
3
expected, got Fixnum problem.
Hi,
I was wondering if anybody knew what ''<some type> expected, got Fixnum''
means? My code looks like the following:
begin
anevent = Event.new
anevent.title = params["event"]["title"]
anevent = session[:user_id]
com = Community.find(params[:id])
com.events << anevent
rescue Exception => exc
...
end
But I get an
2007 Oct 22
1
View spec response has no content?
I have been messing with this all night, and can''t figure out what''s going
wrong here. I have a test that renders the view, and then a shared
behavior checks "response" for the various tags from a rails layout. The
problem is matching. If I run in the browser the page renders
fine. Is there a way to output what the response contains? Here are my
tests:
describe
2011 Jun 13
0
Devise Authorization Error
Hello everyone,
I am new to rails and I am having some trouble getting the Devise
authorization plugin working. I can get the login page to display, but
when I enter the credentials for a known user (I seeded an account to
the database) it just says "Invalid email or password," even though
I''m 100% sure I entered the right information, and redirects me to the
login form.
2010 Jul 13
1
NoMethodError in UsersController#show
So I am getting the error
NoMethodError in UsersController#show error
undefined method `feed'' for nil:NilClass
{"authenticity_token"=>"zalkdfsjfksjd;lfs;lfksdkf/2tPzo=",
"login"=>"session",
"password"=>"admin",
"commit"=>"Log in"}
Why is login being set to "session"? Instead of the
2006 Jun 28
2
NoMethodError when setting session variable
I know this is dumb, but I can not set a session variable. I get the
followig error:
Processing Base#edit (for 67.174.108.88 at 2006-06-28 17:17:34) [GET]
Session ID: 3c4b2bad18c8bc289b719dc056913be7
Parameters: {"action"=>"edit", "id"=>"11", "controller"=>"image",