rubyonrailsin

A Ruby and Rails talk

Monday, March 22, 2010

[spree-user] resource_controller vs. inherited_resources

by rubyonrailsin 0 comments
What are your guys' thoughts on using inherited_resources over
resource_controller?

- http://railsdog.com/blog/2009/07/resource-controller-for-skinny-rails-controllers/
- http://github.com/josevalim/inherited_resources
- http://github.com/jamesgolick/resource_controller

Spree's using resource_controller now, but it looks like
inherited_resources is the more favored one in the community. Any
plans on changing?

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Read More…

[Rails] How to reference a select_tag within a form

by rubyonrailsin 0 comments
Hi All,

Inside my app\views\expenses\new.html.erb file, I had the code:

<% form_for(@expense) do |f| %>
[snip]
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<br />
<div id="vendor_droplist>
<%= select_tag "test",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple => true} %>
</div>
</p>

It brought up a list of vendor-names immediately under my Vendors
textbox, which worked great as far as I was concerned. Then I tried
to turn it into a real drop-down:
1. I added style="display:none" to the div so that the drop-down was
hidden when the page opened
2. I added <%= button_to_function("ShowList",
%<page.toggle :vendor_droplist> ) %> following the text_field

Hiding the drop-down worked, but the button failed to restore it.
Validating the resulting HTML revealed the a div is not permitted in
the scope of a form.

To solve this I removed the <div> opening and closing tags and:
1. added the id to the select_tag:
<%= select_tag "test" :id="vendor_droplist",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple => true} %>
2 added it with a comma
<%= select_tag "test", :id="vendor_droplist",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple => true} %>

Neither these nor any other change I tried worked. So what's the
Rail's way of solving this problem?

I'm running Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox 3.6, MySQL
5.0.37-community-nt, Mongrel.

Thanks in Advance,
Richard

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [Rails] Re: How to initially hide a drop-down control and have an image control make it visible

by rubyonrailsin 0 comments
On Mon, Mar 22, 2010 at 1:35 PM, RichardOnRails
<RichardDummyMailbox58407@uscomputergurus.com> wrote:

> Your "how's the HTML" question really did the job:
> <div> tag not allowed within the scope of a <form> tag.

What gives you that idea? It's simply not true.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [Radiant-Dev] Virtual Pages and Permissions

by rubyonrailsin 0 comments
I'm tentatively for this.

Only tentative because I think we should solidly define the boundaries
of what we expect a regular user to do for the sake of clarity. Since
we've recently moved from a developer role to a designer role and
moved Snippets to be admin/designer accessible only, I think it
warrants at least a quick description of where things like this might
go in the future.

It sounds to me like it will break down like this:

Users may manage regular pages.
Designers may do all of the above, manage special page types, manage
snippets and layouts
Admins may do all of the above, and manage users

What I'm curious about is site settings and how they might break down
among the roles in the future, and if this page type change will be
turned on or off with Radiant::Config.


On Sun, Mar 21, 2010 at 12:08 PM, John W. Long <me@johnwlong.com> wrote:
> Would anyone have any objection to hiding virtual pages from anyone
> who is not an Admin or Designer in 0.9?
>
> It strikes me that virtual pages are mostly used for system specific
> stuff like FileNotFound pages or ArchiveIndex pages. If we went this
> route, we would also hide virtual pages from normal users in the
> PageType dropdown.
>
> --
> John Long
> http://wiseheartdesign.com
> http://recursivecreative.com
>

--
Jim Gay
http://www.saturnflyer.com

--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/

To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
I just realized it too... so bad for me :)

Ok, I thought there would be another more convenient way but as I can
now see there is not

Regards, thanks everyone

On 22 Mar, 21:21, Stephan Wehner <li...@ruby-forum.com> wrote:
> Piotr Mąsior wrote:
> > Model is passed by @model variable with nested attributes so it is
> > like:
>
> > @model = model.new
> > @model.build_another
>
> > at form it is looped through like
>
> > - form_for @account, :url => { :action => @given_action , :controller
> > => 'admin'} do |f|
> > - f.fields_for :company do |o|
> >         %label{:for => "company|name"}=
> > Company.human_attribute_name(:name)
> >         = o.text_field :name, :named => "company|name"
> >         - o.fields_for :city do |x|
> >           %label{:for => "company|city|name"}=
> > City.human_attribute_name(:name)
> >           = x.text_field :name, :named => "company|city|name"
>
> > jquery is responsible for communication and requesting my particular
> > methods so it calls appropriate model basing on something like
> > params[:model], doajaxing method knows how to deal with nested
> > attributes
>
> > so it request from controller some action like
> > doajaxing_for_createmodel and it looks like:
>
> >   def doajaxing_for_createmodel
> >     doajaxing("account")
> >   end
>
> > and doajaxing itself looks like
>
> > def doajaxing(object_name)
> >     if request.xhr?
> >       sended = params[object_name.to_sym]
> >       object_name = object_name.camelize
> >       @process = object_name.constantize
> >       @process = @process.new(sended)
>
> Because you have "@process.new", the "on_create" validations will be
> triggered.
>
> If you are updating an existing record, use
>   @process = @process.find(...model-id...)
> where model-id  is usually taken from "params" (params[:id]).
> Then assign the new values to @process.
>
> Then the "on_create" validations will not be triggered.
>
> >       @process.valid?
> > ##some other processing
> >  if @process.errors[current_given]
> >   #process message and field
> >   #some @response is given in json
> >   render :json => @response
> >  end
> > end
>
> > that it work... I wonder if I can use  instead of @process.valid?
> > something else
>
> Hope that helps. I think your "doajaxing" method needs to know about the
> two cases, create/update.
>
> Stephan
> --
> Posted viahttp://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: How to initially hide a drop-down control and have an image control make it visible

by rubyonrailsin 0 comments
Hey Colin,

Your "how's the HTML" question really did the job:
<div> tag not allowed within the scope of a <form> tag.

Which means the my .erb can't have:

<% form_for(@expense) do |f| %>
[snip]
<div id="vendor_droplist" style="display:none">
<%= select_tag "test",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple => true} %>
</div>

More importantly to me, it means that:

<input onclick="page.toggle :vendor_droplist;" type="button"
value="ShowList" />

won't work inside that form.

I'm going to post a new question on how to fix this while I scour the
documentation to figure it out myself.

Again, thank you for sharing your expertise with me,
Richard


On Mar 21, 10:18 am, Colin Law <clan...@googlemail.com> wrote:
> On 21 March 2010 10:49, RichardOnRails
>
> <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> > Hi Colin,
>
> > Your "check the HTML" tip is *great* ... it's now in my debugging
> > arsenal.
>
> Another tip is to install the Html Validator add-on to Firefox and it
> will automatically validate your pages as you develop, this often
> shows up the reason why something is not working as you expect.
>
> Colin


On Mar 21, 10:18 am, Colin Law <clan...@googlemail.com> wrote:
> On 21 March 2010 10:49, RichardOnRails
>
> <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> > Hi Colin,
>
> > Your "check the HTML" tip is *great* ... it's now in my debugging
> > arsenal.
>
> Another tip is to install the Html Validator add-on to Firefox and it
> will automatically validate your pages as you develop, this often
> shows up the reason why something is not working as you expect.
>
> Colin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [spree-user] Re: User Personalisation of Products

by rubyonrailsin 0 comments
see the theming and hooks guides

Paul

On Mon, Mar 22, 2010 at 8:25 PM, peachygifts <m.ward@leythers.com> wrote:
I've successfully built my personalisation_options model, and I have
associated them with a product. I have succeeded in adding
personalisation_options to a product using script/console.

However, I would now like to present the data in my admin interface.

I would like to know how I can use

<% f.fields_for :personalisation_options do |builder| %>
 <%= render "personalisation_options_fields", :f => builder %>
<% end %>

Within the admin view for product editing (I'm following railscasts
#196 and 197).

I know that I could replace the whole editing view - but that feels
like cracking a nut with a sledgehammer. How else could I simply add
this functionality  to the end of the form.

Thanks for the help so far.

Michael

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.


--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
Read More…

[spree-user] Re: User Personalisation of Products

by rubyonrailsin 0 comments
I've successfully built my personalisation_options model, and I have
associated them with a product. I have succeeded in adding
personalisation_options to a product using script/console.

However, I would now like to present the data in my admin interface.

I would like to know how I can use

<% f.fields_for :personalisation_options do |builder| %>
<%= render "personalisation_options_fields", :f => builder %>
<% end %>

Within the admin view for product editing (I'm following railscasts
#196 and 197).

I know that I could replace the whole editing view - but that feels
like cracking a nut with a sledgehammer. How else could I simply add
this functionality to the end of the form.

Thanks for the help so far.

Michael

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
Piotr Mąsior wrote:
> Model is passed by @model variable with nested attributes so it is
> like:
>
> @model = model.new


> @model.build_another
>
> at form it is looped through like
>
> - form_for @account, :url => { :action => @given_action , :controller
> => 'admin'} do |f|
> - f.fields_for :company do |o|
> %label{:for => "company|name"}=
> Company.human_attribute_name(:name)
> = o.text_field :name, :named => "company|name"
> - o.fields_for :city do |x|
> %label{:for => "company|city|name"}=
> City.human_attribute_name(:name)
> = x.text_field :name, :named => "company|city|name"
>
>
> jquery is responsible for communication and requesting my particular
> methods so it calls appropriate model basing on something like
> params[:model], doajaxing method knows how to deal with nested
> attributes
>
> so it request from controller some action like
> doajaxing_for_createmodel and it looks like:
>
> def doajaxing_for_createmodel
> doajaxing("account")
> end
>
> and doajaxing itself looks like
>
> def doajaxing(object_name)
> if request.xhr?
> sended = params[object_name.to_sym]
> object_name = object_name.camelize
> @process = object_name.constantize
> @process = @process.new(sended)


Because you have "@process.new", the "on_create" validations will be
triggered.

If you are updating an existing record, use
@process = @process.find(...model-id...)
where model-id is usually taken from "params" (params[:id]).
Then assign the new values to @process.

Then the "on_create" validations will not be triggered.

> @process.valid?
> ##some other processing
> if @process.errors[current_given]
> #process message and field
> #some @response is given in json
> render :json => @response
> end
> end
>
>
>
> that it work... I wonder if I can use instead of @process.valid?
> something else

Hope that helps. I think your "doajaxing" method needs to know about the
two cases, create/update.

Stephan
--
Posted via http://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: How do I set defaults for view parameters?

by rubyonrailsin 0 comments
params[:find_dates].nil?

On Mar 22, 12:22 pm, Civ2boss <civ2b...@gmail.com> wrote:
> How would I go about testing the parameter?
>
> On Mar 22, 1:35 pm, Colin Law <clan...@googlemail.com> wrote:
>
> > On 22 March 2010 16:34, Civ2boss <civ2b...@gmail.com> wrote:
>
> > > So I am making a rails app that lets users search logs by date. So in
> > > my controller I have set it to look for logs from the DB using the
> > > parameters. However when it first loads, there are no parameters
> > > passed to the controller, so it gives a nil error.
>
> > > Is there a way to set the default parameters so that it won't have
> > > this error?
>
> > > Here are the controller and view snippets:
>
> > > user_sessions_controller.rb
>
> > > [...]
> > > def admin
>
> > >    @start_date = Date::civil(params[:find_dates]
> > > ['start_date(1i)'].to_i, params[:find_dates]['start_date(2i)'].to_i,
> > > params[:find_dates]['start_date(3i)'].to_i)
>
> > Test params[:find_dates] before you use it and take appropriate action if nil.
>
> > Colin
>
> > >    @end_date = Date::civil(params[:find_dates]["end_date(1i)"].to_i,
> > > params[:find_dates]["end_date(2i)"].to_i, params[:find_dates]
> > > ["end_date(3i)"].to_i)
>
> > >    @logs = Log.all(:conditions => ["updated_at between ? and ?",
> > > @start_date, @end_date], :order => "updated_at DESC")
>
> > >    respond_to do |format|
> > >      format.html { render :action => 'admin' }
> > >      format.csv { render :csv => @logs }
> > >    end
>
> > >  end
> > > [...]
>
> > > admin.html.erb
>
> > > [...]
> > > <div id="find_dates">
> > >        <% form_tag '/find_dates' do %>
> > >                <p>
> > >                        <%= label_tag "start_date", "Start Date" %>
> > >                        <%= date_select "find_dates", "start_date", :order =>
> > > [:month, :day, :year] %>
> > >                </p>
> > >                <p>
> > >                        <%= label_tag "end_date", "End Date" %>
> > >                        <%= date_select "find_dates", "end_date", :order =>
> > > [:month, :day, :year] %>
> > >                </p>
> > >                <%= submit_tag "Find" %>
> > >        <% end %>
> > > </div>
> > > [...]
>
> > > --
> > > 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+unsubscribe@googlegroups.com.
> > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
Model is passed by @model variable with nested attributes so it is
like:

@model = model.new
@model.build_another

at form it is looped through like

- form_for @account, :url => { :action => @given_action , :controller
=> 'admin'} do |f|
- f.fields_for :company do |o|
%label{:for => "company|name"}=
Company.human_attribute_name(:name)
= o.text_field :name, :named => "company|name"
- o.fields_for :city do |x|
%label{:for => "company|city|name"}=
City.human_attribute_name(:name)
= x.text_field :name, :named => "company|city|name"


jquery is responsible for communication and requesting my particular
methods so it calls appropriate model basing on something like
params[:model], doajaxing method knows how to deal with nested
attributes

so it request from controller some action like
doajaxing_for_createmodel and it looks like:

def doajaxing_for_createmodel
doajaxing("account")
end

and doajaxing itself looks like

def doajaxing(object_name)
if request.xhr?
sended = params[object_name.to_sym]
object_name = object_name.camelize
@process = object_name.constantize
@process = @process.new(sended)
@process.valid?
##some other processing
if @process.errors[current_given]
#process message and field
#some @response is given in json
render :json => @response
end
end

that it work... I wonder if I can use instead of @process.valid?
something else


On 22 Mar, 19:57, Stephan Wehner <li...@ruby-forum.com> wrote:
> Piotr Mąsior wrote:
> > So painful, I was wondering is there any dry_save or something like
> > this ?
>
> How do you populate your @model?
>
> Stephan
> --
> Posted viahttp://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Upgrade to 3.0

by rubyonrailsin 0 comments
I am working with a project we are getting ready to release and now
wondering if we should start looking at upgrading to 3.0 beofre
releasing.

I was hoping to get some advice. Of course, upgrading something once
it is released is much harder than doing it prior to release. However,
I am not sure which gems/plugins are going to be compatibale without
bugs and what not.

Thoughts?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: How do I set defaults for view parameters?

by rubyonrailsin 0 comments
How would I go about testing the parameter?

On Mar 22, 1:35 pm, Colin Law <clan...@googlemail.com> wrote:
> On 22 March 2010 16:34, Civ2boss <civ2b...@gmail.com> wrote:
>
>
>
> > So I am making a rails app that lets users search logs by date. So in
> > my controller I have set it to look for logs from the DB using the
> > parameters. However when it first loads, there are no parameters
> > passed to the controller, so it gives a nil error.
>
> > Is there a way to set the default parameters so that it won't have
> > this error?
>
> > Here are the controller and view snippets:
>
> > user_sessions_controller.rb
>
> > [...]
> > def admin
>
> >    @start_date = Date::civil(params[:find_dates]
> > ['start_date(1i)'].to_i, params[:find_dates]['start_date(2i)'].to_i,
> > params[:find_dates]['start_date(3i)'].to_i)
>
> Test params[:find_dates] before you use it and take appropriate action if nil.
>
> Colin
>
>
>
> >    @end_date = Date::civil(params[:find_dates]["end_date(1i)"].to_i,
> > params[:find_dates]["end_date(2i)"].to_i, params[:find_dates]
> > ["end_date(3i)"].to_i)
>
> >    @logs = Log.all(:conditions => ["updated_at between ? and ?",
> > @start_date, @end_date], :order => "updated_at DESC")
>
> >    respond_to do |format|
> >      format.html { render :action => 'admin' }
> >      format.csv { render :csv => @logs }
> >    end
>
> >  end
> > [...]
>
> > admin.html.erb
>
> > [...]
> > <div id="find_dates">
> >        <% form_tag '/find_dates' do %>
> >                <p>
> >                        <%= label_tag "start_date", "Start Date" %>
> >                        <%= date_select "find_dates", "start_date", :order =>
> > [:month, :day, :year] %>
> >                </p>
> >                <p>
> >                        <%= label_tag "end_date", "End Date" %>
> >                        <%= date_select "find_dates", "end_date", :order =>
> > [:month, :day, :year] %>
> >                </p>
> >                <%= submit_tag "Find" %>
> >        <% end %>
> > </div>
> > [...]
>
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: Simple Backup???

by rubyonrailsin 0 comments
Yes and Yes

On Mar 20, 5:25 am, David Chua <zhc...@gmail.com> wrote:
> Is the Apache config the same, is the routes.rb correctly configured?
>
> On Mar 20, 2010 7:03 PM, "nshenry03" <nshenr...@gmail.com> wrote:
>
> I am simply trying to backup a ruby on rails app... I have created an
> archive of the entire database and application folders on server A...
> I then restore the database and application folders on server B....
>
> Server B is exactly the same as A (same OS, same ruby, gems, etc...)
>
> However when I go to the site on server B, all I see is:
>
> Welcome aboard
> You're riding Ruby on Rails!
>
> I've checked and all of the files are in the folders, the DB has data
> in it, I've rebooted apache...
>
> What else do I need to do?
>
> --
> 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+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscrib e@googlegroups.com>
> .
> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Ignite RailsConf call for speaking proposals

by rubyonrailsin 0 comments
hey everyone,

The Rails community in Baltimore is throwing an unofficial but really
awesome pre-party for RailsConf on 6/6/10: Ignite RailsConf. We're
currently looking for speakers who'd like to give an interesting, high-
energy 5 minute talk on any subject. You don't have to be attending
RailsConf to speak or attend Ignite. The proposals are due 4/25 at 5
pm ET.

For more details visit http://igniterailsconf.com or email me.

thanks!

-Mike Subelsky
subelsky.com / oib.com / @subelsky

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
Piotr Mąsior wrote:
> So painful, I was wondering is there any dry_save or something like
> this ?

How do you populate your @model?

Stephan
--
Posted via http://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
So painful, I was wondering is there any dry_save or something like
this ?

On 22 Mar, 18:13, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On Mar 22, 4:59 pm, Piotr <inpr...@gmail.com> Mąsior
>
> <inpr...@gmail.com> wrote:
> > I have got a problem with :on => create validation
>
> > validates_uniqueness_of :nip, :regon, on => :create
>
> The  :on there doesn't refer to the controller action - it refers to
> whether the save is an update to an existing record or not.
>
> Fred
>
>
>
>
>
> > Doesn't work properly when I call it via xhr
>
> > In my log
>
> > Processing AdminController#doajaxing_for_updateuser (for 127.0.0.1 at
> > 2010-03-22 17:37:13) [PUT]
> >   Parameters:
> > {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-92"}},
> > "named"=>"company|nip", "locale"=>"pl"}
>
> > Processing AdminController#doajaxing_for_createuser (for 127.0.0.1 at
> > 2010-03-22 17:31:33) [POST]
> >   Parameters:
> > {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-95"}},
> > "named"=>"company|nip", "locale"=>"pl"}
>
> > It looks fine, Put and Post is given by my jquery request...
>
> > But still validation is always invoking validates_uniqueness_of ....
> > why /.??
>
> > I check validation by:
>
> > @model.valid?
>
> > and later bringing messages using something like this
>
> > @model.errors[current_given]
>
> > regards

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [Radiant-Dev] Radiant as an extension to Radiant?

by rubyonrailsin 0 comments
So what, I wonder, would be involved in setting up a Heroku of
Radiant. A server with a no-write policy? A cadre of people to
maintain. Some capital to buy the hardware...

Thing I don't get is that heroku does host Radiant. Am I missing
something? Actually haven' put radiant on Heroku in ages.

A Heroku of
> Radiant would be most welcome to me, as well :-)
> ~ Alexis
> =================
> Alexis Masters, author
>
>
>
> On Mar 22, 2010, at 11:10 AM, Jason Garber wrote:
>
> This is a slightly old thread, but as one of the competitors Scott
> mentioned, I'd like to say, "Somebody, please put me out of business!" :-)
>  I only hosted Radiant sites for clients because there was no other option.
>  I would immediately switch all my clients to someone else's service if it
> was affordable, let me choose a package of extensions, and had easy
> import/export!  It's not a big moneymaker unless you refine Radiant hosting
> to a cheap, yet reliable, customizable, and scalable commodity.  Somebody
> needs to be the Heroku of Radiant! :-)
> -Jason
>
> On Mar 17, 2010, at 12:04 AM, M. Scott Ford wrote:
>
> Chris,
> I would also love to see some of the details behind how you implemented
> this. However, in the interest of full disclosure, I should mention that I
> am working on building a service that would compete with your small business
> web site service[1]. And from my casual browsing, it looks like I am not the
> only one[2][3]. I won't hold it against you (nor do I think that anyone else
> will) if you decide to keep the details of your implementation closed to the
> public.
> Jim,
> I still have to prove out my concept using the tools that I have mentioned.
> I would prefer to have at least a working proof of concept before adding
> anything to the wiki. But when I am at that stage, I will be sure to put
> something up there. Right now, I am leaning towards building a separate
> project to house this functionality. I think this is more in line with
> radiant's "no fluff" design goal, and I think that multi-site capabilities
> will be useful to more than just radiant users.
> -Scott
> [1]: http://sbmsuite.com/products/make-a-free-website
> [2]: http://radiantmachine.com/
> [3]: http://radiantcmshosting.com/
> On Mar 16, 2010, at 9:39 PM, Jim Gay wrote:
>
> I'd love to see this on the wiki if either of you have time to drop it in
> there.
> On Mar 16, 2010, at 5:02 PM, Chris Rankin wrote:
>
> Much of this functionality, I'm already doing with my application
> SBMSuite.com which is built using Radiant.
> When I create a site it's initially a subdomain of sbmsuite like
> scott.sbmsuite.com, but you can change that to scott.com whenever you want.
> I'm using apache+passenger to handle all request and it's all running of a
> single instance of Radiant. And I just use custom "roles" in my application
> to enable/disable extension per user.
> It works pretty good for me. Is that what your trying to do?
> On Tue, Mar 16, 2010 at 4:56 PM, M. Scott Ford <scott@vaderpi.com> wrote:
>>
>> Hello all,
>>
>> Ugh. I am doing it again, but more reading has lead to more information.
>> It looks like pancake[1] and proxy_stack[2] provide even more of what we
>> would need.
>>
>> One of the features that I would like to see in a multi-site
>> implementation is the ability to allow users to use their own domains.
>> proxy_stack provides the perfect way to do this. Let me present an example.
>>
>> Let's assume that we use warden for authentication and the
>> Rack::Session::Cookie middleware will be used for keeping track of sessions.
>> So we'd create a pancake configuration that looks like this: (source[3]).
>>
>> Pancake.stack(:session).use(Rack::Session::Cookie)
>> Pancake.stack(:auth).use(Warden::Manager) do |manager|
>>  manager.failure_app = FailStack
>>  manager.default_strategies = :password
>> end
>>
>> And then we have two client sites installed in a "/sites" root, and each
>> root points to a full radiant installation with a different set of
>> extensions for each client. The configuration for that would look something
>> like this. (Warning: I have not run this code.)
>>
>> SiteStack < Pancake::Stack
>> SiteStack.router do |r|
>>  r.add("/sites/:client") do |env|
>>    require "sites/#{env['usher.params'][:client]/config/environment"
>>    r.use Rails::Rack::LogTailer
>>    r.use Rails::Rack::Static
>>    ActionController::Dispatcher.new
>>  end
>> end
>>
>> Okay. That is all great, but how do we send "www.customer.com" to
>> "www.host.com/sites/customer". Based on my reading, it looks like we can
>> create a config.ru for each customer, and tell the rack-enabled webserver to
>> serve up that rack config whenever a request is received for
>> "www.customer.com". With apache+passenger you would create a "VirtualHost"
>> with a "ServerName" set to "www.customer.com" and with a "DocumentRoot" that
>> points to the public folder below the directory where the config.ru is
>> located "/var/www/clients/customer/public". That config.ru file will look
>> something like this. (I have not tested this either!)
>>
>> class ::ClientProxy < ProxyStack
>>  configuration.proxy_domain = "www.host.com"
>>  configuration.proxy_port = 80
>>
>>  before_proxy do
>>    client_name = "customer"
>>    # prepend "/sites/customer" to the request path before
>>    # it is forwarded to "www.host.com"
>>    request.path = "/sites/customer/#{request.path}"
>>  end
>> end
>>
>> run ProxyStack.stackup
>>
>> Does that make sense?
>>
>> Thanks,
>> -Scott
>>
>> [1]: http://github.com/hassox/pancake
>> [2]: http://github.com/hassox/proxy_stack
>> [3]:
>> https://gist.github.com/542e8b01412fe4a682bc#file_my_stack_middleware_example.rb
>>
>>
>>
>> On Tuesday, March 16, 2010 2:57pm, "M. Scott Ford" <scott@vaderpi.com>
>> said:
>>
>> > Hello again,
>> >
>> > I hate responding to myself, but it looks like warden[1] and
>> > url_mount[2] would be
>> > a good starting point for this, especially if radiant can be modified to
>> > rely on
>> > rails_warden[3] for authentication. We just need to write a rack
>> > application that
>> > uses warden and url_mount to handle "sites" or child rack applications.
>> >
>> > [1]: http://github.com/hassox/warden
>> > [2]: http://github.com/hassox/url_mount
>> > [3]: http://github.com/hassox/rails_warden
>> >
>> > Thanks,
>> > -Scott
>> >
>> > On Tuesday, March 16, 2010 1:58pm, "M. Scott Ford" <scott@vaderpi.com>
>> > said:
>> >
>> >> Hi all,
>> >>
>> >> I thought I would introduce a wild idea I had this morning while
>> >> thinking about
>> >> multi-site implementations. One reason that I have not tried to use any
>> >> of the
>> >> existing multi-site extensions is I want to have really fine grained
>> >> control
>> >> over
>> >> the gems and radiant extensions that are loaded for each site. (If
>> >> there is a
>> >> way
>> >> to control this with the existing multi-site extensions, then please
>> >> let me know
>> >> how.)
>> >>
>> >> Radiant itself already handles controlling the extensions and gems
>> >> loaded during
>> >> startup. What if we added another layer to that logic, and created an
>> >> extension
>> >> that knows how to do the same thing but for site? So basically, Radiant
>> >> core
>> >> would
>> >> just load the multi-site extension, and then every site would be what
>> >> we now
>> >> consider a Radiant instance. (If that makes any sense.)
>> >>
>> >> Another way to imagine this is to think about the multi-site
>> >> functionality
>> >> becoming the parent of Radiant core, instead of trying to fit a
>> >> multi-site
>> >> extension inside of Radiant (either directly in core or through
>> >> extensions).
>> >>
>> >> I am not all that familiar with the core code-base, yet, so I am not
>> >> sure if
>> >> this
>> >> is possible, but I thought I would pontificate and see what others
>> >> think.
>> >>
>> >> Now that I have typed all of that out, though. It is starting to sound
>> >> to me
>> >> like
>> >> these features might be best implemented as a rack middleware that
>> >> Radiant can
>> >> play nicely with. The middleware would own just sites and users, but
>> >> radiant
>> >> would
>> >> own pages, layout, snippets, etc...
>> >>
>> >> I imagine that this would be useful to others in the Ruby community (if
>> >> it has
>> >> not
>> >> already been done), and it would make it possible to have some sites
>> >> that run
>> >> rails apps, like radiant, others that are simple sinatra apps, and
>> >> others that
>> >> are
>> >> instances of any other rack-based web solution.
>> >>
>> >> Thoughts?
>> >> -Scott
>
> --
> Radiant CMS Dev Mailing List
> Post: radiantcms-dev@googlegroups.com
> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
> Group Site: http://groups.google.com/group/radiantcms-dev/
>
> --
> Radiant CMS Dev Mailing List
> Post: radiantcms-dev@googlegroups.com
> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
> Group Site: http://groups.google.com/group/radiantcms-dev/
>
> --
> Radiant CMS Dev Mailing List
> Post: radiantcms-dev@googlegroups.com
> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
> Group Site: http://groups.google.com/group/radiantcms-dev/
>
> To unsubscribe from this group, send email to
> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
>
> --
> Radiant CMS Dev Mailing List
> Post: radiantcms-dev@googlegroups.com
> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
> Group Site: http://groups.google.com/group/radiantcms-dev/
>
> To unsubscribe from this group, send email to
> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
>

--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/

To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Read More…

Re: [Radiant-Dev] Radiant as an extension to Radiant?

by rubyonrailsin 0 comments
Me too, Jason. I have decided to move most of my clients to Radiant, away from my ancient hand-made and unsupported CMS. I went looking at your site as a potential solution, then decided I'd have to bake my own cookies, so to speak. I have learned alot since then. But I think we all can make a go of this and not really compete because we all have or will have different clientele. As an author as well as a designer/developer, I work 90% with other authors or folks in the publishing industry. I've decided to close DesignByAlexis.com as soon as I can move the most valuable content there to my new site, still under development, called TheAuthorShop.com. I don't want to do any more ecommerce, even if it is Rails ecommerce. I'd rather have time and energy left over for my own writing, so I'd doubtless refer ecommerce prospects to a trusted Radiant colleague, and so on. A Heroku of Radiant would be most welcome to me, as well :-)
~ Alexis
=================
Alexis Masters, author 




On Mar 22, 2010, at 11:10 AM, Jason Garber wrote:

This is a slightly old thread, but as one of the competitors Scott mentioned, I'd like to say, "Somebody, please put me out of business!" :-)  I only hosted Radiant sites for clients because there was no other option.  I would immediately switch all my clients to someone else's service if it was affordable, let me choose a package of extensions, and had easy import/export!  It's not a big moneymaker unless you refine Radiant hosting to a cheap, yet reliable, customizable, and scalable commodity.  Somebody needs to be the Heroku of Radiant! :-)

-Jason

On Mar 17, 2010, at 12:04 AM, M. Scott Ford wrote:

Chris,

I would also love to see some of the details behind how you implemented this. However, in the interest of full disclosure, I should mention that I am working on building a service that would compete with your small business web site service[1]. And from my casual browsing, it looks like I am not the only one[2][3]. I won't hold it against you (nor do I think that anyone else will) if you decide to keep the details of your implementation closed to the public. 

Jim,

I still have to prove out my concept using the tools that I have mentioned. I would prefer to have at least a working proof of concept before adding anything to the wiki. But when I am at that stage, I will be sure to put something up there. Right now, I am leaning towards building a separate project to house this functionality. I think this is more in line with radiant's "no fluff" design goal, and I think that multi-site capabilities will be useful to more than just radiant users.

-Scott


On Mar 16, 2010, at 9:39 PM, Jim Gay wrote:

I'd love to see this on the wiki if either of you have time to drop it in there.

On Mar 16, 2010, at 5:02 PM, Chris Rankin wrote:

Much of this functionality, I'm already doing with my application SBMSuite.com which is built using Radiant.

When I create a site it's initially a subdomain of sbmsuite like scott.sbmsuite.com, but you can change that to scott.com whenever you want. I'm using apache+passenger to handle all request and it's all running of a single instance of Radiant. And I just use custom "roles" in my application to enable/disable extension per user. 

It works pretty good for me. Is that what your trying to do?

On Tue, Mar 16, 2010 at 4:56 PM, M. Scott Ford <scott@vaderpi.com> wrote:
Hello all,

Ugh. I am doing it again, but more reading has lead to more information. It looks like pancake[1] and proxy_stack[2] provide even more of what we would need.

One of the features that I would like to see in a multi-site implementation is the ability to allow users to use their own domains. proxy_stack provides the perfect way to do this. Let me present an example.

Let's assume that we use warden for authentication and the Rack::Session::Cookie middleware will be used for keeping track of sessions. So we'd create a pancake configuration that looks like this: (source[3]).

Pancake.stack(:session).use(Rack::Session::Cookie)
Pancake.stack(:auth).use(Warden::Manager) do |manager|
 manager.failure_app = FailStack
 manager.default_strategies = :password
end

And then we have two client sites installed in a "/sites" root, and each root points to a full radiant installation with a different set of extensions for each client. The configuration for that would look something like this. (Warning: I have not run this code.)

SiteStack < Pancake::Stack
SiteStack.router do |r|
 r.add("/sites/:client") do |env|
   require "sites/#{env['usher.params'][:client]/config/environment"
   r.use Rails::Rack::LogTailer
   r.use Rails::Rack::Static
   ActionController::Dispatcher.new
 end
end

Okay. That is all great, but how do we send "www.customer.com" to "www.host.com/sites/customer". Based on my reading, it looks like we can create a config.ru for each customer, and tell the rack-enabled webserver to serve up that rack config whenever a request is received for "www.customer.com". With apache+passenger you would create a "VirtualHost" with a "ServerName" set to "www.customer.com" and with a "DocumentRoot" that points to the public folder below the directory where the config.ru is located "/var/www/clients/customer/public". That config.ru file will look something like this. (I have not tested this either!)

class ::ClientProxy < ProxyStack
 configuration.proxy_domain = "www.host.com"
 configuration.proxy_port = 80

 before_proxy do
   client_name = "customer"
   # prepend "/sites/customer" to the request path before
   # it is forwarded to "www.host.com"
   request.path = "/sites/customer/#{request.path}"
 end
end

run ProxyStack.stackup

Does that make sense?

Thanks,
-Scott

[1]: http://github.com/hassox/pancake
[2]: http://github.com/hassox/proxy_stack
[3]: https://gist.github.com/542e8b01412fe4a682bc#file_my_stack_middleware_example.rb



On Tuesday, March 16, 2010 2:57pm, "M. Scott Ford" <scott@vaderpi.com> said:

> Hello again,
>
> I hate responding to myself, but it looks like warden[1] and url_mount[2] would be
> a good starting point for this, especially if radiant can be modified to rely on
> rails_warden[3] for authentication. We just need to write a rack application that
> uses warden and url_mount to handle "sites" or child rack applications.
>
> [1]: http://github.com/hassox/warden
> [2]: http://github.com/hassox/url_mount
> [3]: http://github.com/hassox/rails_warden
>
> Thanks,
> -Scott
>
> On Tuesday, March 16, 2010 1:58pm, "M. Scott Ford" <scott@vaderpi.com> said:
>
>> Hi all,
>>
>> I thought I would introduce a wild idea I had this morning while thinking about
>> multi-site implementations. One reason that I have not tried to use any of the
>> existing multi-site extensions is I want to have really fine grained control
>> over
>> the gems and radiant extensions that are loaded for each site. (If there is a
>> way
>> to control this with the existing multi-site extensions, then please let me know
>> how.)
>>
>> Radiant itself already handles controlling the extensions and gems loaded during
>> startup. What if we added another layer to that logic, and created an extension
>> that knows how to do the same thing but for site? So basically, Radiant core
>> would
>> just load the multi-site extension, and then every site would be what we now
>> consider a Radiant instance. (If that makes any sense.)
>>
>> Another way to imagine this is to think about the multi-site functionality
>> becoming the parent of Radiant core, instead of trying to fit a multi-site
>> extension inside of Radiant (either directly in core or through extensions).
>>
>> I am not all that familiar with the core code-base, yet, so I am not sure if
>> this
>> is possible, but I thought I would pontificate and see what others think.
>>
>> Now that I have typed all of that out, though. It is starting to sound to me
>> like
>> these features might be best implemented as a rack middleware that Radiant can
>> play nicely with. The middleware would own just sites and users, but radiant
>> would
>> own pages, layout, snippets, etc...
>>
>> I imagine that this would be useful to others in the Ruby community (if it has
>> not
>> already been done), and it would make it possible to have some sites that run
>> rails apps, like radiant, others that are simple sinatra apps, and others that
>> are
>> instances of any other rack-based web solution.
>>
>> Thoughts?
>> -Scott

--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/


--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/


--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/
 
To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Read More…

Re: [Radiant-Dev] Radiant as an extension to Radiant?

by rubyonrailsin 0 comments
This is a slightly old thread, but as one of the competitors Scott mentioned, I'd like to say, "Somebody, please put me out of business!" :-)  I only hosted Radiant sites for clients because there was no other option.  I would immediately switch all my clients to someone else's service if it was affordable, let me choose a package of extensions, and had easy import/export!  It's not a big moneymaker unless you refine Radiant hosting to a cheap, yet reliable, customizable, and scalable commodity.  Somebody needs to be the Heroku of Radiant! :-)

-Jason

On Mar 17, 2010, at 12:04 AM, M. Scott Ford wrote:

Chris,

I would also love to see some of the details behind how you implemented this. However, in the interest of full disclosure, I should mention that I am working on building a service that would compete with your small business web site service[1]. And from my casual browsing, it looks like I am not the only one[2][3]. I won't hold it against you (nor do I think that anyone else will) if you decide to keep the details of your implementation closed to the public. 

Jim,

I still have to prove out my concept using the tools that I have mentioned. I would prefer to have at least a working proof of concept before adding anything to the wiki. But when I am at that stage, I will be sure to put something up there. Right now, I am leaning towards building a separate project to house this functionality. I think this is more in line with radiant's "no fluff" design goal, and I think that multi-site capabilities will be useful to more than just radiant users.

-Scott


On Mar 16, 2010, at 9:39 PM, Jim Gay wrote:

I'd love to see this on the wiki if either of you have time to drop it in there.

On Mar 16, 2010, at 5:02 PM, Chris Rankin wrote:

Much of this functionality, I'm already doing with my application SBMSuite.com which is built using Radiant.

When I create a site it's initially a subdomain of sbmsuite like scott.sbmsuite.com, but you can change that to scott.com whenever you want. I'm using apache+passenger to handle all request and it's all running of a single instance of Radiant. And I just use custom "roles" in my application to enable/disable extension per user. 

It works pretty good for me. Is that what your trying to do?

On Tue, Mar 16, 2010 at 4:56 PM, M. Scott Ford <scott@vaderpi.com> wrote:
Hello all,

Ugh. I am doing it again, but more reading has lead to more information. It looks like pancake[1] and proxy_stack[2] provide even more of what we would need.

One of the features that I would like to see in a multi-site implementation is the ability to allow users to use their own domains. proxy_stack provides the perfect way to do this. Let me present an example.

Let's assume that we use warden for authentication and the Rack::Session::Cookie middleware will be used for keeping track of sessions. So we'd create a pancake configuration that looks like this: (source[3]).

Pancake.stack(:session).use(Rack::Session::Cookie)
Pancake.stack(:auth).use(Warden::Manager) do |manager|
 manager.failure_app = FailStack
 manager.default_strategies = :password
end

And then we have two client sites installed in a "/sites" root, and each root points to a full radiant installation with a different set of extensions for each client. The configuration for that would look something like this. (Warning: I have not run this code.)

SiteStack < Pancake::Stack
SiteStack.router do |r|
 r.add("/sites/:client") do |env|
   require "sites/#{env['usher.params'][:client]/config/environment"
   r.use Rails::Rack::LogTailer
   r.use Rails::Rack::Static
   ActionController::Dispatcher.new
 end
end

Okay. That is all great, but how do we send "www.customer.com" to "www.host.com/sites/customer". Based on my reading, it looks like we can create a config.ru for each customer, and tell the rack-enabled webserver to serve up that rack config whenever a request is received for "www.customer.com". With apache+passenger you would create a "VirtualHost" with a "ServerName" set to "www.customer.com" and with a "DocumentRoot" that points to the public folder below the directory where the config.ru is located "/var/www/clients/customer/public". That config.ru file will look something like this. (I have not tested this either!)

class ::ClientProxy < ProxyStack
 configuration.proxy_domain = "www.host.com"
 configuration.proxy_port = 80

 before_proxy do
   client_name = "customer"
   # prepend "/sites/customer" to the request path before
   # it is forwarded to "www.host.com"
   request.path = "/sites/customer/#{request.path}"
 end
end

run ProxyStack.stackup

Does that make sense?

Thanks,
-Scott

[1]: http://github.com/hassox/pancake
[2]: http://github.com/hassox/proxy_stack
[3]: https://gist.github.com/542e8b01412fe4a682bc#file_my_stack_middleware_example.rb



On Tuesday, March 16, 2010 2:57pm, "M. Scott Ford" <scott@vaderpi.com> said:

> Hello again,
>
> I hate responding to myself, but it looks like warden[1] and url_mount[2] would be
> a good starting point for this, especially if radiant can be modified to rely on
> rails_warden[3] for authentication. We just need to write a rack application that
> uses warden and url_mount to handle "sites" or child rack applications.
>
> [1]: http://github.com/hassox/warden
> [2]: http://github.com/hassox/url_mount
> [3]: http://github.com/hassox/rails_warden
>
> Thanks,
> -Scott
>
> On Tuesday, March 16, 2010 1:58pm, "M. Scott Ford" <scott@vaderpi.com> said:
>
>> Hi all,
>>
>> I thought I would introduce a wild idea I had this morning while thinking about
>> multi-site implementations. One reason that I have not tried to use any of the
>> existing multi-site extensions is I want to have really fine grained control
>> over
>> the gems and radiant extensions that are loaded for each site. (If there is a
>> way
>> to control this with the existing multi-site extensions, then please let me know
>> how.)
>>
>> Radiant itself already handles controlling the extensions and gems loaded during
>> startup. What if we added another layer to that logic, and created an extension
>> that knows how to do the same thing but for site? So basically, Radiant core
>> would
>> just load the multi-site extension, and then every site would be what we now
>> consider a Radiant instance. (If that makes any sense.)
>>
>> Another way to imagine this is to think about the multi-site functionality
>> becoming the parent of Radiant core, instead of trying to fit a multi-site
>> extension inside of Radiant (either directly in core or through extensions).
>>
>> I am not all that familiar with the core code-base, yet, so I am not sure if
>> this
>> is possible, but I thought I would pontificate and see what others think.
>>
>> Now that I have typed all of that out, though. It is starting to sound to me
>> like
>> these features might be best implemented as a rack middleware that Radiant can
>> play nicely with. The middleware would own just sites and users, but radiant
>> would
>> own pages, layout, snippets, etc...
>>
>> I imagine that this would be useful to others in the Ruby community (if it has
>> not
>> already been done), and it would make it possible to have some sites that run
>> rails apps, like radiant, others that are simple sinatra apps, and others that
>> are
>> instances of any other rack-based web solution.
>>
>> Thoughts?
>> -Scott

--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/


--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/

Read More…

Re: [Rails] Re: Re: Issues RUNNING mysql gem

by rubyonrailsin 0 comments
On 22 March 2010 04:43, Mike Montagne <lists@ruby-forum.com> wrote:
> In the former, you're not even passing the information to the
> environment to build the tables you want. Of course then, it's critical
> to convey your intended design to deployment. A varchar(25) (intended
> field designation) requires 1/10th the disk resources that a string
> field (which translates to varchar(255)).

In the case of MySql I believe that the length of a varchar only
specifies the maximum length, it does not affect the actual space used
in the db as the data is stored as variable length records. I don't
know about postgresql.

Colin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [Rails] Re: Re: Re: Issues RUNNING mysql gem

by rubyonrailsin 0 comments
On 22 March 2010 16:08, Mike Montagne <lists@ruby-forum.com> wrote:
> So let's not argue about this. I should be able to *start* with my
> intended design far faster than I can *eventually* modify a wrong design
> -- imposed in the name of "agility" -- to the right one (which in the
> least, is twice the work).

If you don't like the field definitions generated by the scaffold then
you can edit the migration before you run it, or run another migration
later. Is there anything in your sql table creation that cannot be
specified in migration code?

Colin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[spree-user] Spree + CMS (again)

by rubyonrailsin 0 comments
Hi,

This topic has come up a year and two years ago, but I want to bring
it up again.

We're doing a bigger site, of which e-commerce will be a part of.
Simple extension like static-content won't work in this case - there
will be a lot of content, and it will be dynamic.

Can someone recommend what's the best way to do this? An obvious
solution that I'm thinking is to do the main site using Radiant, and e-
commerce part in Spree, but doesn't look like there's any 'official'
way to do it - I would like to avoid hacking them together myself if
at all possible.

Or is there a better way?

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Read More…

Re: [Rails] How do I set defaults for view parameters?

by rubyonrailsin 0 comments
On 22 March 2010 16:34, Civ2boss <civ2boss@gmail.com> wrote:
> So I am making a rails app that lets users search logs by date. So in
> my controller I have set it to look for logs from the DB using the
> parameters. However when it first loads, there are no parameters
> passed to the controller, so it gives a nil error.
>
> Is there a way to set the default parameters so that it won't have
> this error?
>
> Here are the controller and view snippets:
>
> user_sessions_controller.rb
>
> [...]
> def admin
>
>    @start_date = Date::civil(params[:find_dates]
> ['start_date(1i)'].to_i, params[:find_dates]['start_date(2i)'].to_i,
> params[:find_dates]['start_date(3i)'].to_i)

Test params[:find_dates] before you use it and take appropriate action if nil.

Colin

>
>    @end_date = Date::civil(params[:find_dates]["end_date(1i)"].to_i,
> params[:find_dates]["end_date(2i)"].to_i, params[:find_dates]
> ["end_date(3i)"].to_i)
>
>    @logs = Log.all(:conditions => ["updated_at between ? and ?",
> @start_date, @end_date], :order => "updated_at DESC")
>
>    respond_to do |format|
>      format.html { render :action => 'admin' }
>      format.csv { render :csv => @logs }
>    end
>
>  end
> [...]
>
>
>
> admin.html.erb
>
> [...]
> <div id="find_dates">
>        <% form_tag '/find_dates' do %>
>                <p>
>                        <%= label_tag "start_date", "Start Date" %>
>                        <%= date_select "find_dates", "start_date", :order =>
> [:month, :day, :year] %>
>                </p>
>                <p>
>                        <%= label_tag "end_date", "End Date" %>
>                        <%= date_select "find_dates", "end_date", :order =>
> [:month, :day, :year] %>
>                </p>
>                <%= submit_tag "Find" %>
>        <% end %>
> </div>
> [...]
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: How to debug and profile rails library code ( in windows )

by rubyonrailsin 0 comments
Thanks Luke - freezing the gems is what I need because I am embedding
ruby profile calls in there.

However, now I'm trying to add the profiling inside mongrel, because the
profiling I added in ActionController::Base.process did not show me
where the delay is occurring.

I did an unpack of mongrel and copied it to vendor along with adding the
profiling code, but I'm unable to get the vendor version of
mongrel_rails to execute when I run the script\server.

How do I get the mongrel_rails executable in vendor override the one in
path?

thanks!

>
>> How do I configure my project which currently has gems installed for
>> rails to use source code so I can edit and debug it?
>
> I assume you're debugging anyways:
>
> http://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-ruby-debug
>
> If you do that you can step out into the rails code to see what's
> happening. If you want to actually put debug lines into rails source
> code then how about freezing the rails gems into your project? Then you
> could edit them and step out at any point you like.
>
> Cheers
> Luke

--
Posted via http://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Re: [Rails] Amazon S3 and ffmpeg

by rubyonrailsin 0 comments
buy ec2
upload directly to s3
then ec2machine(or ferm) download from s3, convert, and upload to s3

traffic between ec2 and s3 free
__
Best Regards, Dieinzige

On Mar 22, 2010, at 7:23 PM, James Finley wrote:

> So we are setting up a file upload system for our web app. Files will
> be uploaded to Amazon S3, and videos need to be converted to ffmpeg.
> We have had problems with uploading of large files timing out, and it
> was suggested to us to use http://github.com/elcgit/s3-swf-upload-plugin
> for uploading directly to S3. This would fix the timeout, but then
> could I use ffmpeg to convert the file once it is on S3? If so, how
> would we accomplish this? If not, what would you suggest either for
> fixing the timeout issue or for processing video conversion?
> Essentially, what would be our best solution? Thanks in advance!
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: sub accounts

by rubyonrailsin 0 comments
Anyone else able to provide me with some insight on implementing this?

On Mar 21, 10:55 pm, mlittle <mdlit...@gmail.com> wrote:
> On Mar 21, 10:46 pm, Loganathan Ganesan <li...@ruby-forum.com> wrote:
>
>
>
> > mlittle wrote:
> > > On Mar 21, 10:33 pm, Loganathan Ganesan <li...@ruby-forum.com> wrote:
> > >> I suggest the following database model:
> > >> UserID
>
> > >> In the models
>
> > >> Users => has_many :sub_users
> > >> sub_users => belongs_to :User
>
> > >> so, you should delete first sub_users records, then Users table records.
> > >> --
> > >> Posted viahttp://www.ruby-forum.com/.
>
> > > Seems too easy :). How would I handle the confirmation email and
> > > related issues? Thanks a bunch for the response. I do appreciate it!!
> > mo
> > I don't really understand what are you trying to mean about confirmation
> > email and related issues ?
> > If u don't mind can u explain me in detail?
>
> > Thanks
> > --
> > Posted viahttp://www.ruby-forum.com/.
>
> I'm going to look at the code more but I was talking about creating
> the user just like I would with restful_authentication. I see what you
> are saying but I am still not clear how the new user in sub_user would
> be able to login, logout, and basically do the same as the users in
> Users.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments
On Mar 22, 4:59 pm, Piotr <inpr...@gmail.com> Mąsior
<inpr...@gmail.com> wrote:
> I have got a problem with :on => create validation
>
> validates_uniqueness_of :nip, :regon, on => :create

The :on there doesn't refer to the controller action - it refers to
whether the save is an update to an existing record or not.

Fred

>
> Doesn't work properly when I call it via xhr
>
> In my log
>
> Processing AdminController#doajaxing_for_updateuser (for 127.0.0.1 at
> 2010-03-22 17:37:13) [PUT]
>   Parameters:
> {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-92"}},
> "named"=>"company|nip", "locale"=>"pl"}
>
> Processing AdminController#doajaxing_for_createuser (for 127.0.0.1 at
> 2010-03-22 17:31:33) [POST]
>   Parameters:
> {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-95"}},
> "named"=>"company|nip", "locale"=>"pl"}
>
> It looks fine, Put and Post is given by my jquery request...
>
> But still validation is always invoking validates_uniqueness_of ....
> why /.??
>
> I check validation by:
>
> @model.valid?
>
> and later bringing messages using something like this
>
> @model.errors[current_given]
>
> regards

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

[Rails] Best search function plugin/gem for instant rails 2.0

by rubyonrailsin 0 comments
Hi, I'm creating a simple web app for with multiple tables my
university assignment and I need to create a search function. I've
heard about some search plugins and gems but I'm not sure which is the
best one to use. I'm not much of a coder so if anyone could reccomend
a fairly easy plugin/gem that would not require alot of configuration
that would be great!

Thanks,
Sam.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Read More…

Subscribe feeds via e-mail

Blog Archive