Hey,
I've got 2 models: User and Account::Website that look like this:
class User < ActiveRecord::Base
has_one :website_account, :class_name =>
"Account::Website", :dependent => :destroy
end
class Account::Website < ActiveRecord::Base
belongs_to :user, :touch => true
before_validation :as
Thanks for the reply!
Basically the problem was that we were using a form were we had
dynamically added/removed hidden fields with venue IDs - they were
later passed as an array (:params => {:venue_ids => [something]}),
that's why I was mainly interested in reply#venue_ids= assignment. I
solved it
Hey,
I've got a following scenario: Reply has_many :venues, :through
=> :venue_suggestions. When user answers to a question he can add
venues to it as suggestions. The problem is that these venues
(actually their IDs) are added to the reply form, before the reply is
created. Wnever a venue is adde
Hey,
where exactly are these methods defined? I'd like to use alias_method
to set some parameters before calling the original methods.
Cheers,
Szymon
--
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 r
Hi,
having i.e. a post model that has many categories - is it possible for
member routes like i.e. post_path(post) to generate path like "/
posts/:post_category_name/:post_id" without manually passing the
category param? Does anyone know if there's a gem or if I can simply
override the post_url me
Hi,
I've got 3 models: Comment, Venue and User. Comment has many :venues
and belongs to :user. Venue belongs to :user as well.
When adding a comment, user should be able to attach a venue to it.
In Venue model "user_id" attribute is protected and it is required as
well - this causes problem when
I'm trying to use Bundler for existing Rails 2.3.5 app and got a very
strange problem.
The problem is that on the very first request only the contents of the
action view file are rendered - i.e. when loading the home page
(controller: home, action: index) I get only contents of the app/views/
home
Hi,
I'm trying to update shoulda gem to be Rails 3 compatible and got a
problem with fetching layout name. There's the following code in
shoulda:
@controller.response.layout
which in Rails 2 returns i.e. 'layouts/application'. When this code is
executed in Rails 3, Rails prints out deprecati
Hi,
I'm trying to use shoulda in Rails 3 and there's a small problem. I'm
using branch "rails3" from shoulda repository -
http://github.com/thoughtbot/shoulda/tree/rails3.
The problem is that shoulda tries to auto load some files from
predefined paths and uses Rails.root to build these paths, how
It should be Rails::Generators::Migration.next_migration_number, not
ActiveModel::Generarators::Base.next_migration_number :)
On Jan 30, 3:30 pm, szimek wrote:
> So the solution for now is to make the "next_migration_number" method
> inside my generator to call a class met
ss method, so you just need to do:
>
> ActiveRecord::Generators::Base.next_migration_number
>
> Feel free to work in a patch and assign to me when it's done. If not
> in mood for a patch, please create a ticket on Lighthouse and assign
> to me, so I can tackle it later.
>
ssible with migrations.
>
> Also see:http://guides.rails.info/generators.htmlfor more details ;)
>
> Good luck!
>
> Kristian
>
> On Jan 29, 9:54 pm, szimek wrote:
>
>
>
> > Hi,
>
> > I'd like to add Rails 3 compatible generator to acts_as_taggable_on
Hi,
I'd like to add Rails 3 compatible generator to acts_as_taggable_on
gem (all it does is call "migration_template" method) and got a
problem with "next_migration_number" method not being implemented.
For ActiveRecord this method is defined in
ActiveRecord::Generators::Base class, which inherit
Hi,
I had a problem where fields_for block was executed once, even if the
association collection was empty - child_form.object was nil of
course. Adding accepts_nested_attributes to parent model solved the
problem - block is now executed correctly for each instance of the
collection.
Is this pro
Is it possible that 2 regions in US at any time of year have the same
time offset, both are in daylight savings time, but actually have
different time zones? If not, then it should be easy to map this data
to Rails time zones.
On 24 Lip, 20:21, Philip Hallstrom wrote:
> > we ask user for his zip
Hi,
we ask user for his zip code and currently we also ask for this time
zone (only US). It's a bit redundant, so I'd like to figure out user's
time zone based on his zip code.
The problem is that all services I've seen that provide such data,
provide only time offset and daylight savings flag f
Hi,
I'm displaying i.e. 100 forms that differ only in action and right now
form inputs in every form have the same ids. I could overwrite them
somehow to make them unique, but I don't really need them at all. I
tried setting :id to nil or false, but it displays generated id in
this case.
Thanks
Hi,
I've got Channel model that has many events. Event belongs to channel
and additionally has a named scope called "current".
I need to iterate over each channel and then over each "current" event
for given channel i.e.:
@channels.each do |channel|
channel.events.current do |event|
...
The way it is now written there shouldn't be any difference between
using aasm with AR and any other Ruby class.
Here's very basic example from our User model:
class User < ActiveRecord::Base
include AASM
aasm_column :state # I guess it's the only AR specific method here
aasm_initial_st
Hi,
I'm not exactly sure what you're asking about, but if you want to find
out if the result was already in the db or was it just created, you
could use find_or_initialize_by instead:
post = Post.find_or_initialize_by_title("something completely
different")
post.new_record? # false if it was fou
Hi,
I got a plugin that extends ActionController::AbstractRequest. After
updating Rails from 2.2.2 to 2.3.0 I'm getting the following error:
'load_missing_constant': uninitialized constant
ActionController::AbstractRequest (NameError)
I've already seen people having similar problems with i.e. T
Hi,
I've got format.js block in my code that returns some RJS.
I'm trying to do edit-in-place using RESTful approach and I've added
format.json block to the update action, but I can't figure out how to
setup Ajax.Request, so this format.json block is actually executed.
I've tried adding content
Your login system should provide a way to authenticate using HTTP
basic authentication - most authentication plugins do so i.e.
restful_authentication. If you're not using any plugin, check
http://railscasts.com/episodes/82 to see how to set it up.
Instead of using plain Net::HTTP, you can use Ac
Hi,
I got something like this:
_inner_layout.erb.html
<%= yield %>
<%= yield :sidebar %>
index.erb.html
<% render :layout => "inner_layout" do %>
should be rendered only once
<% end %>
After switching from Rails 2.1 to 2.2 the code above renders "should
be rendered only once" twice. If I add
On 2 Gru, 15:56, Frederick Cheung <[EMAIL PROTECTED]> wrote:
> On 2 Dec 2008, at 14:52, szimek wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm using Rails 2.1.2. and I wanted to switch ActiveResource format to
> > JSON and thought that it will
Hi,
I'm using Rails 2.1.2. and I wanted to switch ActiveResource format to
JSON and thought that it will work smoothly, but unfortunately it
wasn't the case.
XML and JSON formats generate different objects:
XML version
#Mon
Nov 28 11...}>
JSON version
##Mon Nov 28
11...}>
As you can see, when
Hi,
here's simplified code from the model:
class Foo < AR::Base
FIRST = Foo.first.id
end
The problem is that when testing I get well known error: "Called id
for nil...". I guess that this constant is initialized before the
fixtures are loaded.
Is there any way to fix it?
--~--~-~--~-
ingleton
>
> def self.by_name(name)
> self.instance.by_name(name)
> end
>
> def by_name(name)
> return @active_style if @active_style && @active_style.name ==
> name
>
> @active_style = Style.find_by_name(name)
> return @active_style
> end
&g
Hi,
I got i.e. Ticket and TicketChange models and would like to create
TicketChange object whenever Ticket object is updated.
Currently I'm creating new TicketChange in Ticket#after_update
callback and simply serialize slightly modified ticket.changes hash.
Ticket can be updated using 2 ways - u
Hi,
I got a mailer that uses dynamic stylesheets, so when creating an
email I'm doing Style.find_by_name("newsletter").
The problem is that it's fetching the same Style record for each email
it creates and when sending newsletters there can be a lot of them. I
could simply fetch this record in c
Hi,
to send an email with ar_mailer I need to generate it and save it to
the db, right?
Currently the code looks very simple:
Newsletter.recepients.each do |recepient|
NewsletterMailer.deliver_dedicated(request, recepient, newsletter)
end
But for i.e. 3 receivers it's going to take a long
On 7 Wrz, 16:05, "H. Wade Minter" <[EMAIL PROTECTED]> wrote:
> I'm trying to test the code in my helpers, using the great Viget Labs
> helper_me_test plugin. However, I'm running into an oddity (unrelated
> to the plugin - it was happening when I was trying to roll my own
> solution as well
Hi,
let's say you got a Gallery model that has one (to simplify things a
bit for now) Image (attachment_fu model). Gallery has i.e. title and
description, both fields are required. In the "create new gallery
form" you can set title, description and upload the image as well.
What to do if the gal
33 matches
Mail list logo