Hello,
I'd like to ask why is Rails fixing it's version, like gem 'rails',
'3.2.12' ?
Given the recent attacks on Rails - wouldn't it be more secure to not fix
the version?
Maybe have something like '~>3.2.12' ?
--
You received this message because you are subscribed to the Google Groups
I have *Messages* and *User* models with corresponding tables.
The *Messages* table has such fields like *user_from* and *user_to*.
How can associate the models to be able to access sender and recipient
users objects:
message.user_from.name
message.user_to.id
...
Thanks.
--
You received thi
I'm writing facebook canvas application with Rails3 using omniauth-facebook gem.
The few moments are not clear:
Rdirect after sing in (in '/auth/facebook/callback' => 'session#create'):
After successful sing_in if user is redirected to root_url it sometime
arrives to my canvas page URL (ht
John Maxwell wrote in post #1037800:
> This seems like a cruel joke to have to constrain RoR, or any modern web
> framework to IIS. If your company are concerned about rails
> implementations not being "enterprise" enough, then JRuby comes to the
> rescue - coupling the ease of rails with the enter
Getting a strange error on missing translation.
>>I18n.l(Order.first.created_at.to_date)
I18n::MissingTranslationData: translation missing:
en.date.formats.default
But if try this:
I18n.l(Order.first.created_at)
"2011-11-26 13:25:21 UTC"
this is in my config/locale/en.yml
en:
date:
form
hello,
I am writing a js/coffee file that gets erb handling and I need to use
a url helper inside this file
if write
..
url: '<%= url_for(:action => :index) %>'
I get an error:
NoMethodError Exception: undefined method `url_for' for #<#:0xeed1eb8>
>>self.class
# < Sprockets::Context
How do
quot;Rameshwar Vyevhare"
> wrote:
>
>>Pls try out this heroku:rake:db:seed
>>
>>On 08/11/11 3:16 AM, "slava" wrote:
>>
>>>hello,
>>>I am trying to deploy a rails 3.1 app to Heroku and need to run
>>>db:seed
>>>My
heroku:rake:db:seed
command does not exist. Are you sure about this sintax?
On Tue, Nov 8, 2011 at 9:06 PM, Rameshwar Vyevhare
wrote:
> Pls try out this heroku:rake:db:seed
>
> On 08/11/11 3:16 AM, "slava" wrote:
>
>>hello,
>>I am trying to deploy a rails
hello,
I am trying to deploy a rails 3.1 app to Heroku and need to run
db:seed
My seeds file has this code
User.seed do |s|
s.email = "t...@temp.com"
s.password = "bigsecret"
s.password_confirmation = "bigsecret"
end
Running rake db:seed locally works fine, but after deployment to
Heroku I
figured out the answer to this problem. I needed to use :joins to
include associated models in scopes.
On Oct 11, 10:05 pm, slava wrote:
> Hello,
> Have a question related scope definition. I need to define a scope
> based on related model attribute values like this.
>
>
Getting strange loading problem..
>> bundle exec rspec -p spec/models/*
give error:
..
.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/
dependencies.rb:240:in `require': no such file to load -- rspec/rails
(LoadError)
from /home/slava/.rvm/gems/ruby-1.9.
Hello,
Have a question related scope definition. I need to define a scope
based on related model attribute values like this.
class Product < ActiveRecord::Base
belongs_to :currency
scope :with_currency, lambda { |currency|
unless currency.to_s.upcase == 'ALL'
# here I need to define a sco
After upgrading to Rails 3.1.1 I am getting an error related to
inflections for a model - TradeTerms
This model has same name for singular and plural tenses, but this is
now not recognized and I get error:
uninitialized constant TradeTerm
I tried messing around with initializer for inflections and
Great. Just what I was looking for. Thanks.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr..
Hello,
I am trying to replace default restful routes for a few of my models
to something that looks a bit better.
resources :countries
gives
/countries/:id
should be replaced with
/countires/:country_name
Any ideas on how this could be done?
thanks.
--
You received this message because you ar
Hello,
I wonder how to tell my routes.rb to route requests to a resource to
it's parent controller
class Foo < Bar
end
resources :foos ===> controller :bars
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send e
Hello,
I need to remove a validator from a parent model in a child model.
Tried _validators.delete, but that does not seem to work and
validation on parent class is still called.
class Order < ActiveRecord::Base
validate :has_available_shipment
end
class TradeOrder < Order
# tried this from s
Found the answer. thanks. I had to install gem "acts_as_singleton"
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
rub
hello,
I am trying to define a singleton active record on a rails 3.1 app.
What's missing please?
class Bitcoin < Currency
include ActiveRecord::Singleton
end
When I run Bitcoin.instance
get this error:
NameError: uninitialized constant ActiveRecord::Singleton
--
You received this message b
hello,
I am trying to wright a scope with something like this..
class User < ActiveRecord::Base
has_many :balances, :dependent => :destroy
scope :with_positive_balance, where(balances.amount > 0)
end
What is the correct format for this type of scope? Thanks.
--
You received this message be
Hi,
I used code from
http://railscasts.com/episodes/82-http-basic-authentication
but added it to Application controller to apply to the whole
application
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate
protected
def authenticate
pu
Hello,
Is there any setting to make all urls render full address as opposed
to relative by default?
so call to: users_path -> http:localhost:3000/users as opposed to /
users
thanks,
Slava
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Tal
Having problems rendering javascript in erb file. Thanks for
suggestions.
//layout erb file
(function() {
...
var widget_properties = {};
<%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : '' %>
...
})();
//view erb file
<% content_for :extend_widget do %
Hello,
I am getting a strange error when using rspec with nested routes
it 'succeeds' do
get :index, @parameters
response.should be_success
end
...
Failure/Error: get :index, @parameters
ActionController::RoutingError:
No route matches {:website=>#http://somewebsi
found the problem :)
had to change WebsiteUser's has_many :marks to include :foreign_key =>
author_id
class WebsiteUser < ActiveRecord::Base
has_many :marks, :foreign_key => :author_id
has_many :videos_marked, :through => :marks, :source
=> :markable, :source_type => "Video", :class_name => "
Hi,
I am having some difficulty getting has_many relationship setup
correctly.
def acts_as_markable
has_many :marks, :as => :markable
belongs_to :author, :class_name => "WebsiteUser"
end
class Video < ActiveRecord::Base
set_table_name "markables"
acts_as_markable
e
in what file do I put this or similar code?
On Wed, Feb 2, 2011 at 11:00 AM, Slava Mikerin wrote:
> I want is to set
> default_scope :order => 'created_at ASC'
> for all models on default. How is that done?
>
>
> On Wed, Feb 2, 2011 at 6:23 AM, Walter Lee Davis
g Controller-wise
> inherits from ApplicationController, and what about controllers that don't
> just manage one model? This sort of thing has got to end badly is my guess.
>
> Walter
>
>
> On Feb 1, 2011, at 10:15 PM, slava wrote:
>
> I know I can set default_sc
I know I can set default_scope for individual active record model, but
can I set one up for the whole application?
thanks
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.
Hello,
I want to run a template on an a Rails 3 app after it has already been
created. Is there a command for that?
thanks
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups
hello,
I am testing an ActiveResource model create method. The remote service
is sending back a redirect request with newly created record url, but
for some reason redirection fails and I get
1) Error:
test_should_create_a_sales_quotation(SalesQuotationsControllerTest):
ActiveResource::Redirectio
found a way :)
had to overwrite instantiate_record method inside ActiveResource.
On Sun, Sep 27, 2009 at 11:57 PM, slava wrote:
> Hello,
> I have an ActiveResource model that loads imperfectly structured json
> from a third party service. I need to catch response before its parsed
Hello,
I have an ActiveResource model that loads imperfectly structured json
from a third party service. I need to catch response before its parsed
by the model and make a few corrections on the json.
How should I go about doing this?
thanks,
Slava
Hello,
I have many to many relationship between Venue and Catalog
class Venue < ActiveRecord::Base
has_many :venue_catalogs
has_many :catalogs, :through => :venue_catalogs
end
class VenueCatalog < ActiveRecord::Base
belongs_to :venue
belongs_to :catalog
end
class Catalog < ActiveResourc
Quotation < Document < ActiveResource
doc = Document.find(id)
# GET http://someurl/documents/.xml
#
# ...
#
doc.class # => Document
instantiates Document even when the record is a Quotation
How do get the doc to be instantiated as Quotation?
than
ok. I found solution :)
Here is what I did
class SalesDocument < ActiveResource::Base
def encode
builder = Builder::XmlMarkup.new(:indent=>2)
builder.instruct!
builder.tag!('sales-document'){
builder.items('type' => 'array'){
self.items.each do |item|
builder
I am stuck.. here is what i tried
class SalesDocument < ActiveResource::Base
def encode
SalesDocumentsController.new.render_to_string :template, 'rxml-file'
end
end
But that does not work. I get:
NoMethodError: protected method `render_to_string' called for
#
--
Posted via http://www.r
10:56 PM, Slava
> Mikerin wrote:
>
>> I am using ActiveResource to integrate with a 3rd party service.
>> when calling MyModel.save a POST with xml is sent.
>> I need to make sure that xml is created with defined order of
>> elements (the service requires it)
Hello,
I am using ActiveResource to integrate with a 3rd party service.
when calling MyModel.save a POST with xml is sent.
I need to make sure that xml is created with defined order of
elements (the service requires it) How can I do that?
Some have suggested using rxml or builder, but I am not su
SalesDocument < ActiveResource
I need to make sure that when I call
SalesDocument.save
the order of elements in the xml is predetermined and consistent,
which currently not the case.
POST http:///sales_documents.xml
body:
3.0
AD_DASHERBOARD-200
110
10
110
Hello,
I am using ActiveResource to integrate with a 3rd party service.
when calling MyModel.save a POST with xml is sent.
I need to make sure that xml is created with defined order of
elements. How can I do that?
Some have suggested using rxml or builder, but I am not sure how. Has
anyone done th
yeah, I think it is sufficient. thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this grou
Here is my setup:
class Product < ActiveRecord::Base
belongs_to :catalog
has_and_belongs_to_many :product_groups
end
class ProductGroup < ActiveRecord::Base
belongs_to :catalog
has_and_belongs_to_many :products
end
class Catalog < ActiveRecord::Base
has_many :product_groups
has_many
Take a look at active scaffold
http://wiki.github.com/activescaffold/active_scaffold
On Jul 3, 12:18 am, beny 18241
wrote:
> Hi
>
> Anyone knows how to put search option in scaffold?
>
> Reagrds
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
Hi,
I am trying to namespace my models in a Rails app.
I put this in routes
map.namespace(:property) do |property|
property.root :controller => :venues, :active_scaffold =>
true
property.resources :location_groups, :active_scaffold =>
true
end
and this in app/controllers/p
Hello,
I need to integrate my Rails app with SAP back-end. I found this
library sap4rails, which apperenty is meant to help, but I see that
the library has not been modified since 07, and wonder if it is up-to-
date.
http://raa.ruby-lang.org/project/sap4rails
Does anyone have experience working
is up-to-date. I wonder
if anyone has worked with sap4rails and if it is a good solution for
integrating with SAP back-end.
thanks,
Slava
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk"
the questions I have to find answers to are:
- How does one use ActiveRecord with shared models?
- What are the implications of this type of distributed design?
- Relevant design patterns.
thank you,
Slava
--~--~-~--~~~---~--~~
You received this message because you
questions I have to find answers to are:
- How does one use ActiveRecord with shared models?
- What are the implications of this type of distributed design?
- Relevant design patterns.
thank you,
Slava
--~--~-~--~~~---~--~~
You received this message because you are
I need to use an activerecord model in a ruby script that is run from
outside rails, so I need to boot rails from my script, otherwise I
get
uninitialized constant ActiveRecord
I tried adding
require 'config/boot'
to the script to boot rails before running the script, but that did
not help..
--~--
Hello,
I am trying to construct a lookup based on params submited.
possible urls..
/gadgets?product_id=1
/gadgets?product_id=1&product_group_id=2
/gadgets?product_location_id=5
/gadgets?product_id=1&product_location=5
...
How do I write a universal lookup method ?
Gadget.find_by_product_id
Gadge
thanks,
I ended up doing this.
format.json { render :json => @product_locations.to_json
(:include => :product_location_mappings)}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To
here is my model
class ProductLocation < ActiveRecord::Base
belongs_to :property
has_many :product_location_mappings
end
I want to load product_locations along with
referenced :product_location_mappings and return a deep model.
@product_locations = ProductLocation.find_all_by_property_
on the same subject..
I need to ensure uniqness of name in a table. I tried setting collumn
to unique (see below) but that did not work. I still can create
records with same name field.
create_table :properties do |t|
t.string :name, :unique => true
t.string :description
t.t
alternatively if i leave default integer id as primary key I need to
make sure combo of name and version are unique.
create_table :catalogs do |t|
t.string :name
t.string :version, :default => '01'
t.timestamps
end
--~--~-~--~~~---~--~~
Y
I need to create a table replacing default integer id with a string id
and making a combo of (id and version) unique primary key. Here is
what I've got so far.
class CreateCatalogs < ActiveRecord::Migration
def self.up
create_table :catalogs, :id => false do |t|
t.string :id, :limit =
erick Cheung
wrote:
> On Mar 18, 8:42 pm, slava wrote:
>
> > I need to get some of the data for my models from SOAP based services
> > and some from a rails db. I am relatively new to Rails and not sure
> > how to do it right.
>
> > class Product < ActiveR
I need to get some of the data for my models from SOAP based services
and some from a rails db. I am relatively new to Rails and not sure
how to do it right.
class Product < ActiveRecord::Base # products should be loaded
through a soap service from a 3rd party system
belongs_to :product_group
58 matches
Mail list logo