i wonder if ruby on rails have bundles, the ones similar in django?
kind of a plugin that contains css, js, images, ruby code and everything for one feature.
thanks
Rails is setting and returning a remember_token cookie like this:
= cookies[:remember_token]
= value6c69b17681d2bf316f8eexpiresThu Jun 10 14:55:00 -0400 2010
In other words, when I'm calling the cookie I don't just get the value. Why is this?
I am setting the cookie as follows:
cookies[:remember_token] = { :value => @user.remember_me, :expires => 1.year.from_now}
What's going on here?
I am noting this strange behavior where one of my fields -- receive_empresa_test_info -- has worked fine though it's always been referred to as receive_empresa_info. In Functional Tests, though, the real field name is receive_empresa_test_info. What is going on here? Might this be some part of the Rails environment that I'm missing during testing?
I am using rails 2.3.16 ruby 1.8.7
For the following line of code I ma getting error as follows:
Code:
ForeignScheduledItem.find(:all,
:conditions => { :foreign_scheduled_item =>
{ :scheduled_items => { :subscription_id => params[:subscription_id] } } },
:joins => :scheduled_item).each { |i| @subscriptions.push(Subscription.find_by_id(i.subscription_id)) }
Error:
ActiveRecord::StatementInvalid (ActiveRecord::StatementInvalid):
Can u please help in this regard.
Hey,
I'm looking for a way to use something similar to link_to_unless_current but for sub URLs, so for instance for both these URLs:
/entity_name/
/entity_name/123
it will not result as a link. How can I achieve that in Rails?
I am looking to create a rails route that is capable of accepting requests using a regular expression. Specifically, I need optional paths. As an example:
"(/first)?(/second)?"
Would match:
/first
/second
/first/second
But not:
/second/first
Is this possible? Thanks.
I'm new to rails and was trying out the scaffold command - the following scaffold runs and works when I view it via web brick
script/generate book title:string
the following fails - gives me a weird route error
script/generate application name:string
the following works
script/generate app name:string
can anyone shed some light on this? Is 'application' a reserved word?
How do I drop selected tables in Rails? I want to drop all tables from a database with a given prefix. PHPMyAdmin would be very useful at this point.
Thanks
I'm using the facebooker plugin in rails to let users sign up through facebook connect. the application uses iframe. Now when certain things occur,how can I send notifications to application users from the application through facebook.
Is there a standard way to check if a view layout exists from within a Controller in Rails? I'm trying to allow the user to determine the layout, but it needs to exist first.
I have what I think is a very simple problem (famous last words)...
I have a Category model that has_and_belongs_to_many Events. I want to construct a simple and efficient query that finds all categories that have 1 or more events. (using Rails 3)
I'm sure I'm having a dumb moment here - any help appreciated :)
Hi,
I have a store model that has many products with a has_many :through relationship.
I have this working with accepts_nested_attributes, but the result is that rails is making duplicate associates.
I don't have anything special going on it is a very simple app.
Any ideas on why duplicates associates are getting created?
I'm trying to use http://ls1.bigseapreview.com as a domain for a Rails project. The problem is it doesn't seem to be correctly mapping any routing apart from the home page.
I have added /about but you can see that you will just get a 404, but it works locally.
What do I have to do to fix this?
Hi,
is it possible to have the controller value in a rails named route as a parameter, which I can pass at runtime to direct the call to the proper controller?
e.g.
map.ride 'ride' ,:controller = {some-way-of-specifying-a-parameter}, :action = 'ride'
then at runtime, I want to pass the controller name to which this call should be going. My actions are doing different things depending to which controller the call gets sent.
thanks
I have a before_save that calculates a percentage that needs to include the object that is being updated. Is there a one-liner in Rails that takes care of this?
for example and this is totally made up:
Object.find(:all, :include => :updated_object)
Currently I'm sending the object that is getting updated to the definition that calculates the percentage and that works but it's making things messy.
I am trying to remove all 's in my model with the following method :
def about_us_sans_spaces
self.about_us = replace(self.about_us, " ", " ")
end
Except! it turns out 'replace' isn't a method in rails. How would you remove the s?
Mind you, I have already tried sanitized, simple_format. My view looks like this right now:
= truncate(sanitize(simple_format(organization.about_us_sans_spaces), :tags => ''), 125).titleize
Rails: i have a class method and i want to modify something of the instance
something like this:
class Test < Main
template :box
def test
# here I want to access the template name, that is box
end
end
class Main
def initialize
end
def self.template(name)
# here I have to save somehow the template name
# remember is not an instance.
end
end
that is similar to the model classes:
# in the model
has_many :projects
How do I do it?
While moving from php to rails (Means procedural language to Object oriented language), what are the various things you should keep in mind.
How to think in world of object oriented programming?
What are thinks i should kept in mind before starting the things. Any tips?
I am a beginner is rails, every now and then I come across dependencies. I tried to figure out what it means, but was not able to. Can someone please explain me what it means?
Hey all, I'm running into an error using form_tag in Rails 2.3 and can't seem to wrap my head around it. What may I be doing wrong syntactically?
=form_tag :action => 'form', :name => "admin_form"
#images_actions_bar
=submit_tag "Approve", :class => "button", :name => "approve"
=submit_tag "Update", :class => "button", :name => "update"
I am seeing "syntax error, unexpected kENSURE, expecting $end"
Hi,
How can I get hold of the matching route for a url in rails? Given a url, I want to query the respective controller and action. Note, the current page isn't the url in question.
This question has been posed before but wasn't answered.
Cheers.
I'm building some basic Twitter functionality into my app, and am using the JTwitter JAR to read and set status.
It looks like there is a User class that can be used to set the location, but I just can't figure out how to set it with my GPS coordinates once I've got my Twitter object.
Has anyone been able to set the user.location property using JTwitter?
Thanks,
-Gregg
What are the best practices for extending a python module -- in this case I want to extend python-twitter by adding new methods to the base API class.
I've looked at tweepy, and I like that as well, I just find python-twitter easier to understand and extend with the functionality I want.
I have the methods written already, I'm just trying to figure out the best way to add them into the module, without changing the core.