Craig Demyanovich | 1 Oct 01:09 2008
Picon

Re: 1 Form, 3 Models?

The Handle Multiple Models in One Form extract from Advanced Rails Recipes is quite good.

Regards,
Craig

--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Ryan | 1 Oct 01:39 2008
Picon

Re: Submit redirection to incorrect URL


Still having trouble on this one - anyone have any ideas?

Here's the log entry:

Processing AlbumsController#post_comment (for 127.0.0.1 at 2008-09-30
19:33:18) [POST]
  Session ID:
BAh7CToMdXNlcl9pZGkGOg5yZXR1cm5fdG8iEC9mYW1pbGllcy8xOgxjc3Jm
X2lkIiUxY2U3ODYyNjI4ZWJkMWY1MDdmOTI0NGRkYmRjNTFhNSIKZmxhc2hJ
QzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVz
ZWR7AA==--e3e9afa3685c8211fcda8482f58bfc32105cb627
  Parameters: {"commit"=>"Submit",
"authenticity_token"=>"daf5fa075e733d5c8ac954d81b3304d783361e68",
"action"=>"post_comment", "controller"=>"albums",
"comment"=>{"text"=>"test", "album_id"=>"1", "user_id"=>"1"}}

ActiveRecord::RecordNotFound (Couldn't find Family without an ID):

So, I believe that the action in the album controller is working
correctly, since it is being processed, and all of the data is passing
through correctly in the parameters, but it is still directing me back
to /album/post_comments instead of /families/id/albums/id - any ideas?

Thanks,
Ryan

On Sep 29, 10:33 pm, Ryan <ryan.hoffmeis...@...> wrote:
> Hi,
>
> I'm new to rails and I'm building a small app.  I have an album model
> that can have many comments.  Albums belong to families, laid out in
> routes.rb.  I want to be able to add comments in my /albums/
> show.html.erb.  I currently have this in the album controller:
>
> def post_comment
>      <at> comment = Comment.new(params[:comment])
>     respond_to do |format|
>     if Comment.save
>     flash[:notice] = "Comment added"
>     format.html { redirect_to( <at> family,  <at> album) }
>   end
> end
> end
>
> and in the show.html.erb
>
> <div id="comments">
> <center>
> <% if  <at> album.has_comments? %>
> <% for comment in  <at> album.comments %>
>         <%= comment.user.login %> on <%= comment.created_at %>
>         <%=h comment.text %>
> <% end %>
> <% end %>
> </center>
> </div>
>
> <%= link_to_function "Add another comment" do |page|
>         page.insert_html :bottom, :comments, :partial => 'comments' end %>
>
> and the _comments.html.erb looks like:
>
> <% form_for(:comment, :url => {:action => "post_comment"})  do |f| %>
> ...
> <% end %>
>
> routes.rb:
>
>   map.resources :families do |families|
>     families.resources :albums
>   end
>
> The problem is that whenever I hit submit in the Albums show view, it
> re-directs me to /albums/post_comment, which doesn't work because it
> can't find a family.id - I would like to remain on the /family/id/
> album/id page.  Is there something else I need to do here because the
> Album controller is a nested resource?
>
> Thanks,Ryan
--~--~---------~--~----~------------~-------~--~----~
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@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Picon

Re: RJS and :visual_effect


I'm trying to accomplish the same thing with no luck.  So did you just
code the javascript yourself instead of using the helpers?

I second that the documentation seems to be inaccurate...

On Sep 20, 4:56 pm, Olivier Sarrouy <rails-mailing-l...@...>
wrote:
> Finally, i made it work but by coding :
>
> My old code :
>
> link_to_function("Show me more", nil, :id => "more_link") do |page|
>     page[:details].visual_effect  :toggle_blind
>     page[:more_link].replace_html "Show me less"
>   end
>
> doesnt work.
>
> I think the pagehttp://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptHelpe...
> should be modified because it gives a non working example !
>
> cheers
>
> --
> Olivier
> --
> 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@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Ramon Miguel M. Tayag | 1 Oct 03:05 2008
Picon

Re: 1 Form, 3 Models?


I think the complex forms series with Ryan Bates talks about this as well.

Ramon Tayag

On Wed, Oct 1, 2008 at 6:49 AM, Jason <mccreary.jason@...> wrote:
>
> I want to make a single form, but it will potentially create 3 new
> models. There are relationships between these models (belongs_to). I
> have also generated the sections with scaffolding and created form
> partials.
>
> For example, I have a form for a Project (1). This project references
> a Manager (2) and Team (3). In this form, I would like for a user to
> be able to submit a project and either enter this information as new
> or lookup the info (autocompleter I can handle). On the "back-end" I
> would need to be able to save any new Manager and Team data and create
> the necessary relationships...
>
> So my question is, what is the best way to leverage RoR to display and
> save these forms??
> >
>

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

Jason | 1 Oct 03:19 2008
Picon

Re: 1 Form, 3 Models?


Thanks for the quick response!

On Sep 30, 9:05 pm, "Ramon Miguel M. Tayag" <ramon.ta...@...>
wrote:
> I think the complex forms series with Ryan Bates talks about this as well.
>
> Ramon Tayag
>
> On Wed, Oct 1, 2008 at 6:49 AM, Jason <mccreary.ja...@...> wrote:
>
> > I want to make a single form, but it will potentially create 3 new
> > models. There are relationships between these models (belongs_to). I
> > have also generated the sections with scaffolding and created form
> > partials.
>
> > For example, I have a form for a Project (1). This project references
> > a Manager (2) and Team (3). In this form, I would like for a user to
> > be able to submit a project and either enter this information as new
> > or lookup the info (autocompleter I can handle). On the "back-end" I
> > would need to be able to save any new Manager and Team data and create
> > the necessary relationships...
>
> > So my question is, what is the best way to leverage RoR to display and
> > save these forms??
--~--~---------~--~----~------------~-------~--~----~
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@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Peter Alvin | 1 Oct 03:49 2008
Picon

Re: Session lost with IE7 but not FF... 8 hours hit head/wall


Thanks for your suggestions!

We figured it out.  IE misbehaves if the subdomain has an underscore in 
it.  Ours did.

Pete
--

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

Bala | 1 Oct 04:50 2008
Picon

JSON + Rails + Javascript


Hello Experts,

When i try to use json converstion for Array it works perfectly in
local machine,

But when i deployed to server it says this error message which i
detected on firebug

I've two datas on DB
Model - Codes

Codes
1 - First
2 - Second
3 - Third

Here I have a code like this
Controller
name = "%#{params[:id]}%"
 <at> codes = Code.find(:all, :condition => ["name like ?", name])

on View

<input type="text" id="input_id">
<a href="javascript:void(0);"
onclick="filter_this(document.getElementById('input_id'), <
%= <at> codes.to_json%>);">Click Me</a>

and javascript code
function filter_this(myInput,  codes) {
  for(var i=0;i<codes.length;i++) {
    var myid = codes[i].attributes;
    var filter_divs = 'div' + myid.id;
    document.getElementById(filter_divs);
  }
}

This code works perfectly in local but in server it says myid has no
properties.

NOTE: I've included all necessary javascript codes.

Thanks in advance
Bala
--~--~---------~--~----~------------~-------~--~----~
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@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Phillip Koebbe | 1 Oct 04:55 2008
Picon

Re: Session lost with IE7 but not FF... 8 hours hit head/wal


Peter Alvin wrote:
> Thanks for your suggestions!
> 
> We figured it out.  IE misbehaves if the subdomain has an underscore in 
> it.  Ours did.
> 
> Pete

Actually, some would argue that IE did the right thing, sort of, and 
that Firefox misbehaved. I ran into the same problem a number of months 
ago with Safari. Firefox worked, but Safari didn't. It was the same 
problem. A couple of people posted and pointed out that the RFC for URLs 
does not permit underscores in the hostname (what you are calling the 
subdomain, I think). The funny part is that if the browsers were 
completely standards compliant, the web sites shouldn't work in them at 
all. In my case (and I think your's), you can access the web sites, but 
it's the cookie that's failing.

Peace.
--

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

Anthony E. | 1 Oct 06:13 2008
Picon

statistics table via a trigger


I'm trying to implement something similar to a historical price chart,
where I save the prices when they change to a "stats" table.

I'd like to take the current value and save it to a statistics model
before it gets updated with the new value.

Is there a way to do it with a trigger or should I just save the value
in two different models?

Something like this:

 <at> book = Book.find(params[:id])
 <at> stats = Stat.new()

puts  <at> book.price #=> $10.00

 <at> stats.book_id =  <at> book.id
 <at> stats.price =  <at> book.price

 <at> book.price = $20.00

 <at> book.save()
 <at> stats.save()
--

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

gdevore | 1 Oct 06:48 2008
Picon

Re: RJS and :visual_effect


This syntax worked for me:

<%= link_to_function "Details" do |page|
         page.visual_effect(:toggle_blind, 'toto')
  end %>

 <div id="toto">
    Bouh
 </div>

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


Gmane